Guest User

Untitled

a guest
May 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. class Proc
  2. def <<(other)
  3. if other.kind_of?(Proc)
  4. lambda { |x| other.call(call(x)) }
  5. else
  6. call(other)
  7. end
  8. end
  9. end
  10.  
  11. a = lambda { |x| x + 1 }
  12. b = lambda { |x| x * 2 }
  13.  
  14. p a << b << 2
Add Comment
Please, Sign In to add comment