Don Abrams
09/20/2020, 3:48 PMf : B <- A
instead of f : A -> B
) then function composition like f . g
would make more sense.
Then a couple chapters later he goes on to say that writing (x)f
instead of f(x)
would make (f.g)(x)
be ((x)g)f
(or even maybe xgf
)
Both are nice suggestions, but the mix really does hurt my headS.M Mukarram Nainar
09/20/2020, 4:12 PMDoug Moen
09/21/2020, 12:40 AM(x)f
to call a function. The wikipedia page describes how this simplifies the algebraic manipulation of lambda terms, and makes certain proofs easier.
https://en.wikipedia.org/wiki/De_Bruijn_notationDoug Moen
09/21/2020, 12:54 AMx |> f
means f x
, and an infix function composition operator where f >> g
is the same as g . f
in Haskell. This design has become popular, and has been widely copied by newer functional languages.eyal
09/21/2020, 6:15 AMf x
- is "dominated" by f
which may choose to evaluate or not evaluate x
at all, and in any case f
and its application are evaluated first. So it makes sense to see things ordered by their importance: f (g (h x)).
In an eager language, it's nicer to see things read by their evaluation order: x |> g |> f
(though f
or g
as function yielding expressions are actually be evaluated first, their application is evaluated later).eyal
09/21/2020, 6:16 AMf : B <- A
or f : A -> B
is analogy to arithmetic. A -> B
is B ^ A
(B raised to the power of A). So making the notations align up could be nicewtaysom
09/23/2020, 3:18 AM