|
@@ -56,12 +56,12 @@ discard block |
|
|
block discarded – undo |
|
56
|
56
|
|
|
57
|
57
|
public static function plus(): Closure |
|
58
|
58
|
{ |
|
59
|
|
- return static fn (callable $a): Closure => static fn (callable $b): Closure => static fn (callable $c): Closure => Combinators::B()($a($c))($b($c)); |
|
|
59
|
+ return static fn(callable $a): Closure => static fn(callable $b): Closure => static fn(callable $c): Closure => Combinators::B()($a($c))($b($c)); |
|
60
|
60
|
} |
|
61
|
61
|
|
|
62
|
62
|
public static function pred(): Closure |
|
63
|
63
|
{ |
|
64
|
|
- return static fn (callable $a): Closure => static fn (callable $b): Closure => static fn ($c) => $a(static fn ($d): Closure => static fn ($e) => $e($d($b)))(static fn () => $c)(Combinators::I()); |
|
|
64
|
+ return static fn(callable $a): Closure => static fn(callable $b): Closure => static fn($c) => $a(static fn($d): Closure => static fn($e) => $e($d($b)))(static fn() => $c)(Combinators::I()); |
|
65
|
65
|
} |
|
66
|
66
|
|
|
67
|
67
|
public static function seven(): Closure |
|
@@ -76,7 +76,7 @@ discard block |
|
|
block discarded – undo |
|
76
|
76
|
|
|
77
|
77
|
public static function succ(): Closure |
|
78
|
78
|
{ |
|
79
|
|
- return static fn (callable $n): Closure => static fn (callable $f): Closure => Combinators::B()($f)($n($f)); |
|
|
79
|
+ return static fn(callable $n): Closure => static fn(callable $f): Closure => Combinators::B()($f)($n($f)); |
|
80
|
80
|
} |
|
81
|
81
|
|
|
82
|
82
|
public static function three(): Closure |
|
@@ -86,14 +86,13 @@ discard block |
|
|
block discarded – undo |
|
86
|
86
|
|
|
87
|
87
|
public static function toInt(callable $numeral): int |
|
88
|
88
|
{ |
|
89
|
|
- return $numeral(static fn (int $n): int => $n + 1)(0); |
|
|
89
|
+ return $numeral(static fn(int $n): int => $n + 1)(0); |
|
90
|
90
|
} |
|
91
|
91
|
|
|
92
|
92
|
public static function toNumeral(int $n): Closure |
|
93
|
93
|
{ |
|
94
|
94
|
return 0 === $n - 1 ? |
|
95
|
|
- Numeral::one() : |
|
96
|
|
- Numeral::plus()(Numeral::one())(Numeral::toNumeral($n - 1)); |
|
|
95
|
+ Numeral::one() : Numeral::plus()(Numeral::one())(Numeral::toNumeral($n - 1)); |
|
97
|
96
|
} |
|
98
|
97
|
|
|
99
|
98
|
public static function two(): Closure |
|
@@ -103,6 +102,6 @@ discard block |
|
|
block discarded – undo |
|
103
|
102
|
|
|
104
|
103
|
public static function zero(): Closure |
|
105
|
104
|
{ |
|
106
|
|
- return static fn (callable $s): Closure => Combinators::I(); |
|
|
105
|
+ return static fn(callable $s): Closure => Combinators::I(); |
|
107
|
106
|
} |
|
108
|
107
|
} |