Created
November 25, 2010 17:56
-
-
Save bakkdoor/715717 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def map: block { | |
"Returns a new @Array@ with the results of calling a given block for every element" | |
coll = [] | |
each: |x| { | |
if: (block argcount == 0) then: { | |
coll << (block call_with_receiver: x) # <- had to add this part.. | |
} else: { | |
coll << (block call: [x]) | |
} | |
} | |
coll | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment