Add support for expressions
hason opened this issue · 5 comments
hason commented
It would be amazing to add a shorthand notation for closures:
$xs = Ginq::from(array(1,2,3))->where('x % 2 != 0')->select('x * x');
and/or
$xs = Ginq::from(array(1,2,3))
->where(['x' => 'x % 2 != 0'])->select(['v, k' => 'k+v']);
See
cursedcoder commented
👍
akanehara commented
👍
akanehara commented
Added support for free variables.
['x'=>'x + y', 'y'=>$y]
means
function ($x) use ($y) { return $x + $y; }
akanehara commented
Added short lambda wrapper.
$y = 99;
$f = Ginq::fun(['x'=>'x + y', 'y'=>$y]);
echo $f(1);
100