Widmogrod\Primitive\Listt::traverse PHP 메소드

traverse() 공개 메소드

public traverse ( callable $transformation )
$transformation callable
    public function traverse(callable $transformation)
    {
        return f\foldr(function ($ys, $x) use($transformation) {
            $functor = $transformation($x);
            return $functor->map(f\append)->ap($ys ? $ys : $functor::of([]));
            // https://github.com/widmogrod/php-functional/issues/30
        }, false, $this);
    }