Have been struggling with fix for years, and this made my head scratch again:
fix = f: let fixpoint = f fixpoint; in fixpoint
const = a: b: a
( fix ( const ( a: b: a + b ))) 1 2 #=> 3
( fix ( const ( a: b: c: a + b + c))) 1 2 3 #=> 6
For some reason I can't wrap my head around this.
Turns out, I was massively overthinking this... To quote Nathan Faubion:
This is probably evident, but looks like I wasn't able to put two and two together.
constabove can be thought of simply wrapping an input function,and the examples can be rewritten in the following forms:
Writing out the evaluation steps:
To belabor the point, input
xis literally ignored:Putting the PureScript version here, because it looks slightly different as PureScript is strict, unlike Nix:
(Again, see Nathan's reply for more details.)