Haskell's dollar sign is a wonderful function that for f $ g
, for example, f
is evaluated with the results of g
as its argument. This can work brilliantly like this
sin $ sqrt $ abs $ f 2
Which is equivalent to
sin(sqrt(abs(f(2))))
The dollar sign is nice to me because it is more readable. I have noticed that Julia has |>
which pipelines. This seems to do f |> g
meaning that g
takes the evaluated result of f
as an argument. From what I have noticed, it seems that I could write the aforementioned expression like this
2 |> f |> abs |> sqrt |> sin
But I was wondering if there was some operator such that I could do something like what I did in Haskell.