public static function shrink(callable $f, $roses) { $roses = FP::realize($roses); if (empty($roses)) { return self::pure(call_user_func($f)); } else { return new self(call_user_func_array($f, FP::realize(FP::map(FP::method('getRoot'), $roses))), FP::rgen(FP::map(FP::partial([__CLASS__, 'shrink'], $f), self::remove($roses)))); } }
public static function intRoseTree($val) { $me = [__CLASS__, 'intRoseTree']; return new RoseTree($val, FP::map($me, self::shrinkInt($val))); }