[ create a new paste ] login | about

Link: http://codepad.org/T5mLPAbE    [ raw code | output | fork ]

jleedev - Ruby, pasted on Apr 16:
1
2
3
4
5
6
7
8
9
module Enumerable
  def mymap &b
    results = []
    each {|x| results << b[x] }
    results
  end
end

p [1,2,3].mymap {|x| x+1}


Output:
1
[2, 3, 4]


Create a new paste based on this one


Comments: