Philip Cunningham music, code and stuff.

Map from Reduce 31 May 2013

def _map coll, fn
  coll.reduce [] { |coll, val| coll.concat([fn.(val)]) }
end

_map [1, 2, 3, 4, 5], ->(x){x*x} # => [1, 4, 9, 16, 25]