Skip to content

Instantly share code, notes, and snippets.

@fjolnir
Created June 22, 2012 17:53
Show Gist options
  • Save fjolnir/2974220 to your computer and use it in GitHub Desktop.
Save fjolnir/2974220 to your computer and use it in GitHub Desktop.
- 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