4 ms·
Plus, first class functions can be shown with mere high school mathematics. Lambda are really easy: the f: R -> R x |-> blah(x) you find in high s
by loup-vaillant 17y ago
Plus, first class functions can be shown with mere high school mathematics. Lambda are really easy: the
f: R -> R
x |-> blah(x)
you find in high school would be
f : (float -> float)
= fun x -> blah x
In Ocaml (and probably F#).
The composition operator can easily be seen as a function with two arguments, which show "first class" functions:
o : (R->R), (R->R) -> (R -> R )
(f , g ) |-> (x |-> f(g(x)))
And poof, you can introduce currying:
o : ((R->R), (R->R) , R) -> R
(f , g , x) |-> f(g(x)))