Method: Rupture::Sequence#map

Defined in:
lib/rupture/sequence.rb

#map(f = nil, &fn) ⇒ Object



157
158
159
160
161
162
# File 'lib/rupture/sequence.rb', line 157

def map(f = nil, &fn)
  fn ||= f
  F.lazy_loop(seq) do |recur, s|
    F.cons(fn[s.first], recur[s.next]) if s
  end
end