Lambdas

Sort by

recency

|

22 Discussions

|

  • + 0 comments
    # Write a lambda which takes an integer and square it
    square      = proc { |num| num ** 2 }
    
    # Write a lambda which takes an integer and increment it by 1
    plus_one    = proc { |num| num + 1 }
    
    # Write a lambda which takes an integer and multiply it by 2
    into_2      = proc { |num| num * 2 }
    
    # Write a lambda which takes two integers and adds them
    adder       = proc { |a, b| a + b }
    
    # Write a lambda which takes a hash and returns an array of hash values
    values_only = proc { |num_hash| num_hash.values.to_a }
    
    
    input_number_1 = gets.to_i
    input_number_2 = gets.to_i
    input_hash = eval(gets)
    
    a = square.(input_number_1); b = plus_one.(input_number_2);c = into_2.(input_number_1); 
    d = adder.(input_number_1, input_number_2);e = values_only.(input_hash)
    
    p a; p b; p c; p d; p e
    
  • + 0 comments

    Here is Lambdas problem solution - https://www.gyangav.com/2022/10/hackerrank-ruby-lambdas-problem-solution.html

  • + 0 comments

    Here are the solution of Ruby Lambdas HackerRank Solution you can find All HackerRank Ruby Tutorial solutions in Single Post HackerRank Ruby Tutorial solutions

  • + 0 comments

    Is this good idea to use this script in wordPress website? I'm working on content based wesbite of Slip On Comfortable Work Boots and I want to use this script for my content blog.

  • + 0 comments

    Lambda runs your code on high availability compute infrastructure and performs all the administration of your compute resources. briser un couple rapidement