Pipe Operator
The pipe operator |> passes the result of an expression as the first parameter of another expression.
The pipe operator |>> passes the result of an expression as the last parameter of another expression.
Example
primitive Str
fun trim (s: String): String =>
...
fun upper (s: String): String =>
...
fun print(s: String, env: Env) =>
env.out.print(s)
primitive Trace
fun print(env: Env, s: String) =>
env.out.print(s)
actor Main
new create(env: Env) =>
let s = " I Love Pony "
s |> Str.trim |> Str.upper |> Str.print(env) //"I LOVE PONY"
s |>> Str.trim |>> Str.upper |>> Trace.print(env) //"I LOVE PONY"
Pipe Operator
The pipe operator
|>passes the result of an expression as the first parameter of another expression.The pipe operator
|>>passes the result of an expression as the last parameter of another expression.Example