Re:Functional programming is not popular because it is weird...
by thaumasiotes on Tuesday September 14, 2021 @05:46AM
(#28522350)
> piping vs nesting are different syntaxes for function composition: x|A|B|C vs C(B(A(x)))
> The former might feel more comfortable, familiar, and left-to-right readable for someone new to FP.
C(B(A(x))) is the syntax introduced in school, but note that if you continue on in algebra the notation flips from C(B(A(x))) to x_{ABC}. Everyone agrees that it's easier to list the transformations in the order they happen.
Re:Functional programming is not popular because it is weird...
by chitowneats on Tuesday September 14, 2021 @12:29AM
(#28520234)
Clojure has two primary macros for this, thread-first (->), and thread-last (->>).
They enable you to write pipe transformations and in my opinion make the code much more readable.
You're correct and I think that's kinda the parent's point. I think what the OP is saying is that the much of the syntax ergonomics are orthogonal to FP, which means they don't have to be as weird/frustrating/unusual/insert preference/unergonomic as they are.
A good example is how piping vs nesting are different syntaxes for function composition: x|A|B|C vs C(B(A(x)))
The former might feel more comfortable, familiar, and left-to-right readable for someone new to FP. That said I think a few language do use piping. F# has |> and I think Clojure used >>> maybe? -- signed, humble java programmer.