The Little PHPer - 9. ... and Again, and Again, and Again, ... Jul 2, 2018 Scheme PHP [Source Code] looking function looking ($s, $l) {return keep_looking($s, pick(1, $l), $l); } keep-looking [1] function keep_looking ($s, $sorn, $l) {return is_number($sorn) ? keep_looking($s, pick($sorn, $l), $l) : is_eq($sorn, $s); } eternity function eternity ($x) {return eternity($x); } shift function shift ($pair) {return build(first(first($pair)), build(second(first($pair)), second($pair))); } align function align ($pora) {return is_atom($pora) ? $pora : (is_pair(first($pora)) ? align(shift($pora)) : build(first($pora), align(second($pora)))); } length* function length_star ($pora) {return is_atom($pora) ? 1 : plus(length_star(first($pora)), length_star(second($pora))); } weight* function weight_star ($pora) {return is_atom($pora) ? 1 : plus(x(weight_star(first($pora)), 2), weight_star(second($pora))); } shuffle function shuffle ($pora) {return is_atom($pora) ? $pora : (is_pair(first($pora)) ? shuffle(revpair($pora)) : build(first($pora), shuffle(second($pora)))); } C [2] function C ($n) {return is_one($n) ? 1 : (is_even($n) ? C(division($n, 2)) : C(add1(x(3, $n)))); } A [3], [4], [5] function A ($n, $m) {return is_zero($n) ? add1($m) : (is_zero($m) ? A(sub1($n), 1) : A(sub1($n), A($n, sub1($m)))); } Y [6] function Y ($le) {return (function ($f) {return $f($f); })(function ($f) use ($le) {return $le(function ($x) use ($f) {return $f($f)($x); }); }); } [7] Partial function/Total function Lothar Collatz Wilhelm Ackermann Kurt Gödel Alan Turing Y Combinator Y Combinator in PHP