@@ -15,16 +15,16 @@ |
||
| 15 | 15 | { |
| 16 | 16 | public static function first(): Closure |
| 17 | 17 | { |
| 18 | - return static fn (callable $a) => $a(true); |
|
| 18 | + return static fn(callable $a) => $a(true); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public static function of(): Closure |
| 22 | 22 | { |
| 23 | - return static fn ($a): Closure => static fn ($b): Closure => static fn ($f) => $f ? $a : $b; |
|
| 23 | + return static fn($a): Closure => static fn($b): Closure => static fn($f) => $f ? $a : $b; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function second(): Closure |
| 27 | 27 | { |
| 28 | - return static fn (callable $a) => $a(false); |
|
| 28 | + return static fn(callable $a) => $a(false); |
|
| 29 | 29 | } |
| 30 | 30 | } |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public static function eight(): Closure |
| 20 | 20 | { |
| 21 | - return static fn (callable $s) => static fn ($z) => $s($s($s($s($s($s($s($s($z)))))))); |
|
| 21 | + return static fn(callable $s) => static fn($z) => $s($s($s($s($s($s($s($s($z)))))))); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public static function exponentiation(): Closure |
| 25 | 25 | { |
| 26 | - return static fn (callable $f): Closure => static fn (callable $n): Closure => $n($f); |
|
| 26 | + return static fn(callable $f): Closure => static fn(callable $n): Closure => $n($f); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public static function five(): Closure |
| 33 | 33 | { |
| 34 | - return static fn (callable $s): Closure => static fn ($z) => $s($s($s($s($s($z))))); |
|
| 34 | + return static fn(callable $s): Closure => static fn($z) => $s($s($s($s($s($z))))); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -39,17 +39,17 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public static function four(): Closure |
| 41 | 41 | { |
| 42 | - return static fn (callable $s): Closure => static fn ($z) => $s($s($s($s($z)))); |
|
| 42 | + return static fn(callable $s): Closure => static fn($z) => $s($s($s($s($z)))); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public static function minus(): Closure |
| 46 | 46 | { |
| 47 | - return static fn (callable $x): Closure => static fn (callable $y): Closure => $y(self::pred())($x); |
|
| 47 | + return static fn(callable $x): Closure => static fn(callable $y): Closure => $y(self::pred())($x); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public static function multiply(): Closure |
| 51 | 51 | { |
| 52 | - return static fn (callable $x): Closure => static fn (callable $y): Closure => $x(self::plus()($y))(self::zero()); |
|
| 52 | + return static fn(callable $x): Closure => static fn(callable $y): Closure => $x(self::plus()($y))(self::zero()); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public static function nine(): Closure |
| 59 | 59 | { |
| 60 | - return static fn (callable $s): Closure => static fn ($z) => $s($s($s($s($s($s($s($s($s($z))))))))); |
|
| 60 | + return static fn(callable $s): Closure => static fn($z) => $s($s($s($s($s($s($s($s($s($z))))))))); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -65,21 +65,20 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public static function one(): Closure |
| 67 | 67 | { |
| 68 | - return static fn (callable $s): Closure => static fn ($z) => $s($z); |
|
| 68 | + return static fn(callable $s): Closure => static fn($z) => $s($z); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | public static function plus(): Closure |
| 72 | 72 | { |
| 73 | - return static fn (callable $x): Closure => static fn (callable $y): Closure => static fn ($s): Closure => static fn ($z) => $x($s)($y($s)($z)); |
|
| 73 | + return static fn(callable $x): Closure => static fn(callable $y): Closure => static fn($s): Closure => static fn($z) => $x($s)($y($s)($z)); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public static function pred(): Closure |
| 77 | 77 | { |
| 78 | - return static fn (callable $n): Closure => static fn (callable $next): Closure => static fn ($first) => Pair::second()( |
|
| 78 | + return static fn(callable $n): Closure => static fn(callable $next): Closure => static fn($first) => Pair::second()( |
|
| 79 | 79 | $n( |
| 80 | - static fn (callable $pair): Closure => Pair::first()($pair) ? |
|
| 81 | - Pair::of()(false)($first) : |
|
| 82 | - Pair::of()(false)($next(Pair::second()($pair))) |
|
| 80 | + static fn(callable $pair): Closure => Pair::first()($pair) ? |
|
| 81 | + Pair::of()(false)($first) : Pair::of()(false)($next(Pair::second()($pair))) |
|
| 83 | 82 | )(Pair::of()(true)($first)) |
| 84 | 83 | ); |
| 85 | 84 | } |
@@ -89,7 +88,7 @@ discard block |
||
| 89 | 88 | */ |
| 90 | 89 | public static function seven(): Closure |
| 91 | 90 | { |
| 92 | - return static fn (callable $s) => static fn ($z) => $s($s($s($s($s($s($s($z))))))); |
|
| 91 | + return static fn(callable $s) => static fn($z) => $s($s($s($s($s($s($s($z))))))); |
|
| 93 | 92 | } |
| 94 | 93 | |
| 95 | 94 | /** |
@@ -97,12 +96,12 @@ discard block |
||
| 97 | 96 | */ |
| 98 | 97 | public static function six(): Closure |
| 99 | 98 | { |
| 100 | - return static fn (callable $s) => static fn ($z) => $s($s($s($s($s($s($z)))))); |
|
| 99 | + return static fn(callable $s) => static fn($z) => $s($s($s($s($s($s($z)))))); |
|
| 101 | 100 | } |
| 102 | 101 | |
| 103 | 102 | public static function succ(): Closure |
| 104 | 103 | { |
| 105 | - return static fn (callable $n): Closure => static fn (callable $s): Closure => static fn ($z) => $s($n($s)($z)); |
|
| 104 | + return static fn(callable $n): Closure => static fn(callable $s): Closure => static fn($z) => $s($n($s)($z)); |
|
| 106 | 105 | } |
| 107 | 106 | |
| 108 | 107 | /** |
@@ -110,7 +109,7 @@ discard block |
||
| 110 | 109 | */ |
| 111 | 110 | public static function three(): Closure |
| 112 | 111 | { |
| 113 | - return static fn (callable $s) => static fn ($z) => $s($s($s($z))); |
|
| 112 | + return static fn(callable $s) => static fn($z) => $s($s($s($z))); |
|
| 114 | 113 | } |
| 115 | 114 | |
| 116 | 115 | /** |
@@ -118,7 +117,7 @@ discard block |
||
| 118 | 117 | */ |
| 119 | 118 | public static function two(): Closure |
| 120 | 119 | { |
| 121 | - return static fn (callable $s) => static fn ($z) => $s($s($z)); |
|
| 120 | + return static fn(callable $s) => static fn($z) => $s($s($z)); |
|
| 122 | 121 | } |
| 123 | 122 | |
| 124 | 123 | /** |
@@ -126,6 +125,6 @@ discard block |
||
| 126 | 125 | */ |
| 127 | 126 | public static function zero(): Closure |
| 128 | 127 | { |
| 129 | - return static fn (callable $s) => static fn ($z) => $z; |
|
| 128 | + return static fn(callable $s) => static fn($z) => $z; |
|
| 130 | 129 | } |
| 131 | 130 | } |
@@ -15,41 +15,41 @@ |
||
| 15 | 15 | { |
| 16 | 16 | public static function booleanToPrimitive(): Closure |
| 17 | 17 | { |
| 18 | - return static fn (callable $l): Closure => static fn (bool $m): Closure => static fn (bool $n): bool => $l($m)($n); |
|
| 18 | + return static fn(callable $l): Closure => static fn(bool $m): Closure => static fn(bool $n): bool => $l($m)($n); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public static function CAnd(): Closure |
| 22 | 22 | { |
| 23 | - return static fn (callable $l): Closure => static fn (callable $c): Closure => $l($c)(self::CFalse()); |
|
| 23 | + return static fn(callable $l): Closure => static fn(callable $c): Closure => $l($c)(self::CFalse()); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function CFalse(): Closure |
| 27 | 27 | { |
| 28 | - return static fn ($t): Closure => static fn ($f) => $f; |
|
| 28 | + return static fn($t): Closure => static fn($f) => $f; |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public static function CIf(): Closure |
| 32 | 32 | { |
| 33 | - return static fn (callable $if): Closure => self::CTrue()($if)(self::CFalse()); |
|
| 33 | + return static fn(callable $if): Closure => self::CTrue()($if)(self::CFalse()); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public static function CNot(): Closure |
| 37 | 37 | { |
| 38 | - return static fn (callable $fn): Closure => $fn(self::CFalse())(self::CTrue()); |
|
| 38 | + return static fn(callable $fn): Closure => $fn(self::CFalse())(self::CTrue()); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | public static function COr(): Closure |
| 42 | 42 | { |
| 43 | - return static fn (callable $l): Closure => static fn (callable $c): Closure => $l(self::CTrue())($c); |
|
| 43 | + return static fn(callable $l): Closure => static fn(callable $c): Closure => $l(self::CTrue())($c); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public static function CTrue(): Closure |
| 47 | 47 | { |
| 48 | - return static fn ($t): Closure => static fn ($f) => $t; |
|
| 48 | + return static fn($t): Closure => static fn($f) => $t; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public static function CXor(): Closure |
| 52 | 52 | { |
| 53 | - return static fn (callable $a): Closure => static fn (callable $b) => ($a($b(self::CFalse())(self::CTrue())))($b(self::CTrue())(self::CFalse())); |
|
| 53 | + return static fn(callable $a): Closure => static fn(callable $b) => ($a($b(self::CFalse())(self::CTrue())))($b(self::CTrue())(self::CFalse())); |
|
| 54 | 54 | } |
| 55 | 55 | } |