public function testTakeAllAAndBStream() { $f = aAndB(); $d = $f(emptyState()); $this->assertEquals('((((#(1) . 5) . ((#(0) . 7))) . 2) . ((((#(1) . 6) . ((#(0) . 7))) . 2)))', sprintf('%s', takeAll($d))); }
function runStar($g) { return map('MicroKanren\\Core\\reifyFirst', takeAll(callGoal(fresh($g)))); }
/** * Returns all results from a stream. * * @param [Cons|callable] $d a stream */ function takeAll($d) { $d = pull($d); if (isNull($d)) { return nil(); } else { return cons(car($d), takeAll(cdr($d))); } }