Skip to content

Instantly share code, notes, and snippets.

@lmller
Created October 20, 2016 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmller/6211a1c0544248f69fa0ee60d2dbb561 to your computer and use it in GitHub Desktop.
Save lmller/6211a1c0544248f69fa0ee60d2dbb561 to your computer and use it in GitHub Desktop.
infix fun<T, R> T.pipe(rhs: (T) -> R) = rhs(this)
@lmller
Copy link
Author

lmller commented Oct 20, 2016

can call it e.g. like this
1..10 pipe ::println

1..10 pipe { it.reduce { l,r -> l+r }} pipe ::println

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment