Method: Array#bind
- Defined in:
- lib/funkr/extensions/array.rb
#bind(&block) ⇒ Object
Array is also a monad
- 1,2].bind{|x| [3,4].bind{|y| x + y}} # => [4,5,5,6
59 60 61 |
# File 'lib/funkr/extensions/array.rb', line 59 def bind(&block) self.map(&block).flatten(1) end |