Created
October 19, 2011 23:59
-
-
Save bdenckla/1300038 to your computer and use it in GitHub Desktop.
PHP function implementing partial function application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function Pa() // Partially Apply | |
{ | |
$origArgs = func_get_args(); | |
return function() use ( $origArgs ) | |
{ | |
$allArgs = array_merge( $origArgs, func_get_args() ); | |
return call_user_func_array( 'call_user_func', $allArgs ); | |
}; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment