Pipelines
It can be hard to read repeated function calls, because of all the nested brackets.
You can make this easier to read by breaking it into many declarations, but that is a bit annoying.
Instead, you can use the pipeline operator (|>) to simplify this.
Basically, x |> f(%) is a shorthand for f(x). The left-hand side of the |> gets put into
the % in the right-hand side.
So, this means x |> f(%) |> g(%) is shorthand for g(f(x)). The code example above, with its
somewhat-clunky x0 and x1 constants could be rewritten as
This helps keep your code neat and avoid unnecessary declarations.
Pipelines and keyword arguments
Say you have a long pipeline of sketch functions, like this:
In this example, each function call outputs a sketch, and it gets put into the next function call via
the %, into the first (unlabeled) argument.
If a function call uses an unlabeled first parameter, it will default to % if it's not given. This
means that |> line(%, end = [3, 4]) and |> line(end = [3, 4]) are equivalent! So the above
could be rewritten as