|Y combinator in mit-scheme|
Y combinator in Arc
(let ((g (lambda (h)
(f (lambda (x)
((f (h h)) x))))))
The shortest working definition of Y I can think of. It makes use of
Arc's bracketed anonymous functions of a single argument. These types
of bracketed anonymous functions of one argument cannot be nested as
they all bind their argument to the underscore.
(let g (fn (h)
(f [(f (h h)) _]))
What if they could be nested? Maybe the outermost function would bind
its argument to @0, and subsequently nested functions would bind their
arguments to unique variables by incrementing the integer (@0, @1, @2,
...). Then we could write Y quite compactly like this.
(def Y [let g [@0 [(@0 (@1 @1)) @2]] (g g)])