Skip to content

Commit

Permalink
Made apply more useful and created call
Browse files Browse the repository at this point in the history
  • Loading branch information
syhol authored Aug 15, 2016
1 parent ae00641 commit 1dbfb8a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion functional.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,13 @@ function partial(callable $callable, ...$params) {
};
}

function apply(callable $callable, ...$params) {
function apply(...$params) {
return function ($callable) use ($params) {
return $callable(...$params);
}
}

function call(callable $callable, ...$params) {
return $callable(...$params);
}

Expand Down

0 comments on commit 1dbfb8a

Please sign in to comment.