Created
June 22, 2012 17:53
-
-
Save fjolnir/2974220 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
- map: lambda { | |
^self reduce: { obj accum=#[] | accum push lambda(obj) } | |
} | |
- _reduce: lambda result: result { | |
^self empty? unless: { | |
result push lambda(self next) | |
^self _map:lambda result: result | |
} else: { | |
^result | |
} | |
} | |
- reduce: lambda { | |
accum = lambda(self next) | |
^self _reduce result accum | |
} | |
- map: mapLambda reduce: reduceLambda { | |
(self map: mapLambda) reduce: reduceLambda | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment