> function Y($F) {
>       $func =  function ($f) { return $f($f); };
>       return $func(function ($f) use($F) {
>               return $F(function ($x) use($f) {
>                       $ff = $f($f);
>                       return $ff($x);
>               });
>       });
> }

That's interesting; I should be able to implement tail-recursion in a
similar fashion using, say, trampolines,[1] shouldn't I?

> On the other hand, we may want to add some way to refer to the
> closure currently being run. We should have this information, so it
> should not be too hard to do.

That would be great; we could even do some benchmarking against the
Y-combinator (which I've always loved, but never used).

Footnotes: 
[1]  http://en.wikipedia.org/wiki/Tail_recursion#Implementation_methods

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to