Skip to content

Instantly share code, notes, and snippets.

@apaleslimghost
Last active October 7, 2015 02:28
Show Gist options
  • Save apaleslimghost/3090376 to your computer and use it in GitHub Desktop.
Save apaleslimghost/3090376 to your computer and use it in GitHub Desktop.
Cute one-line alternative to function pipe chaining in LiveScript
Object::go = (...funcs)->fold (|>), this, funcs
[1 to 10].go do
filter odd
map (^ 2)
fold1 (+)
#=>165
#compare:
[1 to 10]
|> filter odd
|> map (^ 2)
|> fold1 (+)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment