Question 1
irb(main):001:0> lambda_a = lambda do |x| irb(main):002:1* lambda do |y| irb(main):003:2* puts "Hello #{x} #{y}" irb(main):004:2> end irb(main):005:1> lambda do |z| irb(main):006:2* puts "Goodbye #{x} #{z}" irb(main):007:2> end irb(main):008:1> end => #<Proc:0x223d780@(irb):1 (lambda)> irb(main):009:0> lambda_a.(1).(2) ???
Question 2
irb(main):010:0> lambda_b = lambda do |x| irb(main):011:1* lambda do |y| irb(main):012:2* puts "Hello #{x} #{y}" irb(main):013:2> end irb(main):014:1> lambda do |z, zz| irb(main):015:2* puts "Goodbye #{x} #{z} #{zz}" irb(main):016:2> end irb(main):017:1> end => #<Proc:0x1dfd680@(irb):10 (lambda)> irb(main):018:0> lambda_b.(1).(2) ???
No comments:
Post a Comment