public function test_return() { $countArgs = function () { return func_num_args(); }; $this->assertInstanceOf(Closure, P\binary($countArgs), 'binary should return a closure'); $this->assertEquals(2, P\binary($countArgs)->__invoke(1, 2, 3), 'binary should eat all but two arguments'); }
</ul> </section> <section> <h2>Thrill as I convert this Hash Array to an array of Tupples!</h2> <p> <?php $tupleMaker = P\S(P\ternary('array_map')->__invoke(function ($val, $key) { return [$key, $val]; }), 'array_keys'); $testDataAsTuple = $tupleMaker(testData); ?> <?php echo $jsonTestData; ?> —$map(x, y -> [y,x])→ <?php echo json_encode($testDataAsTuple); ?> </p> <p>And to show why I picked these numbers</p> <ul> <?php P\flip(P\binary('array_walk'))->__invoke(function ($tuple) { echo "<li>2<sup>{$tuple['0']}</sup> = {$tuple['1']}</li>" . PHP_EOL; }, $testDataAsTuple); ?> </ul> </section> </body> </html>