|
|
|
|
|
by themulticaster
1857 days ago
|
|
While you didn't refer to any explicit programming language (so your example is correct by definition), I think you may have mixed up something. The order is reversed, but typically not in the way you describe. For your example of f(g(h(x))), you would write (f . g . h) x in Haskell. So for this particular example, the syntactical order is not reversed. However, you could say the natural order of reading is reversed: The naive way to read (f . g . h) might be "first f, then g, then h", opposite the actual order of execution. |
|
Anyway, here is some ghci session exemplifying the usage of the & operator
It's unfortunate that this is named & in Haskell and not |>. And what's worse, it's not in the prelude.