function appendo2($l, $s, $out) { return disj(conj(eq(nil(), $l), eq($s, $out)), callFresh(function ($a) use($l, $s, $out) { return callFresh(function ($d) use($a, $l, $s, $out) { return conj(eq(cons($a, $d), $l), callFresh(function ($res) use($a, $d, $s, $out) { return conj(function ($sC) use($d, $s, $res) { return function () use($d, $s, $res, $sC) { $f = appendo2($d, $s, $res); return $f($sC); }; }, eq(cons($a, $res), $out)); })); }); })); }
public function create() { $post = nil(Post::class); $groups = (new PostService())->getGroupList(); return view('admin.posts.create', compact('post', 'groups')); }
public function testMzero() { $this->assertEquals(nil(), mzero()); }
public function testMapOverNil() { $isOdd = function ($x) { return $x % 2 !== 0; }; $this->assertEquals(nil(), map($isOdd, nil())); }
/** * Returns a list constructed of nested cons cells from the given arguments. * A convenience function equivalent to Scheme's list. * * e.g. list(1, 2, 3) is the same as cons(1, cons(2, cons(3, nil()))) * * @param mixed $elements the elements of the list */ function alist() { $elements = func_get_args(); $length = func_num_args(); $list = nil(); for ($i = $length - 1; $i >= 0; $i -= 1) { $list = cons($elements[$i], $list); } return $list; }
function reifyFirst($sC) { $v = walkStar(variable(0), car($sC)); return walkStar($v, reifyS($v, nil())); }