February 2019
Beginner to intermediate
180 pages
4h 4m
English
Reason has two pipe operators:
|> (pipe)-> (fast pipe)
Both pipe operators pass arguments to functions. The |> pipe operator pipes to a function's last argument and the -> fast pipe operator pipes to a function's first argument.
Take a look at these:
three |> f(one, two)one -> f(two, three)
They are equivalent to this:
f(one, two, three)
If the function only accepts one argument, then both pipes work the same, since the function's first argument is also the function's last argument.
Using these pipe operators is quite popular, since, once you get the hang of it, it makes the code a lot more readable.
We don't need to use this:
Belt.List.(reduce(map([1, 2, 3], e => e + 1), 0, (+)))
We can write it in a way that doesn't require ...
Read now
Unlock full access