bermudaphp / curry
v1.0
2023-03-10 20:26 UTC
Requires
- php: ^8.1
- bermudaphp/reflection-type-matcher: ^1.0
This package is auto-updated.
Last update: 2024-11-11 00:01:11 UTC
README
composer require bermudaphp/curry
Usage
$add = new Curry(static fn(int $a, $int $b) => $a+$b, 10); // alternative $add = curry(static fn(int $a, $int $b) => $a+$b, 10); $add(5); // 15 // alternative $add->call(5); // add new arguments $decrement = $add->add(-5); $decrement(); // 5 // Allow default argument values $add = curry(static fn(int $a, $int $b = 5) => $a + $b, 10)->useDefaultValues(true); // alternative $add = Curry::use(static fn(int $a, $int $b = 5) => $a + $b, 10) $add() // 15