Skip to content

Instantly share code, notes, and snippets.

@rightfold

rightfold/gist:edfaf232a92160de7647 Secret

Last active Aug 29, 2015
Embed
What would you like to do?
func map(xs, f, go result = list()) {
if empty?(xs) {
result;
} else {
go(tail(xs), f, f(head(xs)) :: result);
};
}
// is sugar for
func map(xs, f) {
func __go(xs, f, result) {
if empty?(xs) {
result;
} else {
__go(tail(xs), f, f(head(xs)) :: result);
};
}
__go(xs, f, list());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment