Добавил namespace и зависимости
This commit is contained in:
parent
e9f7c23990
commit
32ec09a66a
92 changed files with 454 additions and 128 deletions
|
|
@ -8,7 +8,9 @@
|
|||
/**
|
||||
* Эмуляция каррированой функции
|
||||
*/
|
||||
class __right {
|
||||
namespace ctiso;
|
||||
|
||||
class right {
|
||||
protected $params;
|
||||
protected $fn;
|
||||
|
||||
|
|
@ -24,7 +26,7 @@ class __right {
|
|||
}
|
||||
}
|
||||
|
||||
class __left {
|
||||
class left {
|
||||
protected $params;
|
||||
protected $fn;
|
||||
|
||||
|
|
@ -41,7 +43,7 @@ class __left {
|
|||
}
|
||||
|
||||
define('__', '_ARGUMENT_PLACE_');
|
||||
class __partial {
|
||||
class partial {
|
||||
protected $params;
|
||||
protected $fn;
|
||||
|
||||
|
|
@ -69,7 +71,7 @@ class __partial {
|
|||
/**
|
||||
* Композиция функций
|
||||
*/
|
||||
class __compose {
|
||||
class compose {
|
||||
protected $fns;
|
||||
function __construct($list) {
|
||||
$this->fns = array_reverse($list);
|
||||
|
|
@ -89,7 +91,7 @@ class __compose {
|
|||
class Functions {
|
||||
|
||||
static function partial($_rest) {
|
||||
$closure = new __partial(func_get_args());
|
||||
$closure = new partial(func_get_args());
|
||||
return array($closure, 'apply');
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +104,7 @@ class Functions {
|
|||
* @return array[int]mixed
|
||||
*/
|
||||
static function compose($_rest) {
|
||||
$closure = new __compose(func_get_args());
|
||||
$closure = new compose(func_get_args());
|
||||
return array($closure, 'apply');
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +114,7 @@ class Functions {
|
|||
* @return array[int]mixed
|
||||
*/
|
||||
static function rcurry($_rest) {
|
||||
$closure = new __right(func_get_args ());
|
||||
$closure = new right(func_get_args ());
|
||||
return array($closure, 'apply');
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +124,7 @@ class Functions {
|
|||
* @return array[int]mixed
|
||||
*/
|
||||
static function lcurry($_rest) {
|
||||
$closure = new __left(func_get_args ());
|
||||
$closure = new left(func_get_args ());
|
||||
return array($closure, 'apply');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue