Skip to content

Instantly share code, notes, and snippets.

@yocontra
Created March 17, 2014 17:13
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 yocontra/9603799 to your computer and use it in GitHub Desktop.
Save yocontra/9603799 to your computer and use it in GitHub Desktop.
Overloads the | operator to let you put streams together. This is just a fun project, don't use this.
macro | {
rule infix {
$x:expr | $y ($args ...)
} => {
$x.pipe($y($args...))
}
rule infix {
$x:expr | $y
} => {
$x.pipe($y)
}
}
/*
a | b(2) | c(1) | haha | 123
becomes
a.pipe(b(2)).pipe(c(1)).pipe(haha).pipe(123);
*/
@junosuarez
Copy link

🍻

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