@@ -16,31 +16,31 @@ discard block |
||
16 | 16 | { |
17 | 17 | public static function concat(): Closure |
18 | 18 | { |
19 | - return static fn (callable $xs): Closure => static fn (callable $ys): Closure => self::foldr()(self::cons())($ys)($xs); |
|
19 | + return static fn(callable $xs): Closure => static fn(callable $ys): Closure => self::foldr()(self::cons())($ys)($xs); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public static function cons() |
23 | 23 | { |
24 | - return static fn (callable $a): Closure => static fn (callable $b): Closure => Pair::of()(Boolean::CFalse())(Pair::of()($a)($b)); |
|
24 | + return static fn(callable $a): Closure => static fn(callable $b): Closure => Pair::of()(Boolean::CFalse())(Pair::of()($a)($b)); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public static function foldl() |
28 | 28 | { |
29 | - return static fn (callable $f): Closure => static fn ($a): Closure => static fn (callable $xs) => self::foldr()( |
|
30 | - static fn (callable $x): Closure => static fn (callable $g): Closure => static fn ($y) => $g($f($y)($x)) |
|
31 | - )(static fn ($x) => $x)($xs)($a); |
|
29 | + return static fn(callable $f): Closure => static fn($a): Closure => static fn(callable $xs) => self::foldr()( |
|
30 | + static fn(callable $x): Closure => static fn(callable $g): Closure => static fn($y) => $g($f($y)($x)) |
|
31 | + )(static fn($x) => $x)($xs)($a); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | public static function foldr() |
35 | 35 | { |
36 | 36 | return Combinators::Y()( |
37 | - static fn (callable $r): Closure => static fn (callable $f): Closure => static fn ($a): Closure => static fn (callable $xs) => Boolean::CIf()(self::isNil()($xs))(static fn () => $a)(static fn () => $f(self::head()($xs))($r($f)($a)(self::tail()($xs))))() |
|
37 | + static fn(callable $r): Closure => static fn(callable $f): Closure => static fn($a): Closure => static fn(callable $xs) => Boolean::CIf()(self::isNil()($xs))(static fn() => $a)(static fn() => $f(self::head()($xs))($r($f)($a)(self::tail()($xs))))() |
|
38 | 38 | ); |
39 | 39 | } |
40 | 40 | |
41 | 41 | public static function head() |
42 | 42 | { |
43 | - return static fn (callable $a): Closure => Pair::first()(Pair::second()($a)); |
|
43 | + return static fn(callable $a): Closure => Pair::first()(Pair::second()($a)); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public static function isNil() |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | public static function length() |
52 | 52 | { |
53 | - return self::foldl()(static fn (callable $a): Closure => static fn (callable $b): Closure => Numeral::succ()($a))(Numeral::zero()); |
|
53 | + return self::foldl()(static fn(callable $a): Closure => static fn(callable $b): Closure => Numeral::succ()($a))(Numeral::zero()); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | public static function nil() |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | |
61 | 61 | public static function range() |
62 | 62 | { |
63 | - return static fn (callable $a): Closure => static fn (callable $b): Closure => Numeral::minus()(Numeral::succ()($b))($a)(static fn (callable $c): Closure => CList::cons()(Numeral::minus()($b)(CList::length()($c)))($c))(CList::nil()); |
|
63 | + return static fn(callable $a): Closure => static fn(callable $b): Closure => Numeral::minus()(Numeral::succ()($b))($a)(static fn(callable $c): Closure => CList::cons()(Numeral::minus()($b)(CList::length()($c)))($c))(CList::nil()); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | public static function repeat() |
67 | 67 | { |
68 | - return static fn (callable $a): Closure => static fn (callable $b): Closure => $b( |
|
69 | - static fn ($c): Closure => CList::cons()($a)($c) |
|
68 | + return static fn(callable $a): Closure => static fn(callable $b): Closure => $b( |
|
69 | + static fn($c): Closure => CList::cons()($a)($c) |
|
70 | 70 | )(CList::nil()); |
71 | 71 | } |
72 | 72 | |
@@ -77,6 +77,6 @@ discard block |
||
77 | 77 | |
78 | 78 | public static function tail(): Closure |
79 | 79 | { |
80 | - return static fn (callable $a): Closure => Pair::second()(Pair::second()($a)); |
|
80 | + return static fn(callable $a): Closure => Pair::second()(Pair::second()($a)); |
|
81 | 81 | } |
82 | 82 | } |