File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ protected static function __pipe(...$fs)
2525
2626 protected static function __dot ($ f , $ g )
2727 {
28- return function ($ x ) {
28+ return function ($ x) use ( $ f , $ g ) {
2929 return $ f ($ g ($ x ));
3030 };
3131 }
Original file line number Diff line number Diff line change 44
55use Vector \Core \Module ;
66use Vector \Lib \Lambda ;
7+ use Vector \Lib \Math ;
78
89class LambdaTest extends \PHPUnit_Framework_TestCase
910{
@@ -104,4 +105,11 @@ public function testFlip()
104105 $ this ->assertEquals (4 , $ subtract (2 , 6 )); // 6 - 2
105106 $ this ->assertEquals (-4 , $ flippedSubtract (2 , 6 )); // 2 - 6
106107 }
108+
109+ public function testDot ()
110+ {
111+ $ add2ThenAdd1 = Lambda::dot (Math::add (1 ), Math::add (2 ));
112+
113+ $ this ->assertEquals (3 , $ add2ThenAdd1 (0 ));
114+ }
107115}
You can’t perform that action at this time.
0 commit comments