Skip to content

Instantly share code, notes, and snippets.

@torus
Created June 19, 2012 09:15
Show Gist options
  • Select an option

  • Save torus/2953169 to your computer and use it in GitHub Desktop.

Select an option

Save torus/2953169 to your computer and use it in GitHub Desktop.
echo call_user_func(call_user_func(function ($func) {
return call_user_func(function ($f) use ($func) {
return call_user_func(function ($g) use ($f) {
return function ($n) use ($f, $g) {
return call_user_func($g($f($f)), $n);
};
}, $func);
}, function ($f) use ($func) {
return call_user_func(function ($g) use ($f) {
return function ($n) use ($f, $g) {
return call_user_func($g($f($f)), $n);
};
}, $func);
});},
function ($h) { /* Fibonacci */
return function ($n) use ($h) {
return ($n <= 2) ? 1 : ($h($n - 2) + $h($n - 1));
};
}), 10);
echo "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment