UsageΒΆ

Verify some functors laws:

<?php

declare(strict_types=1);

include 'vendor/autoload.php';

use loophp\lambada\Map;
use loophp\lambada\Id;
use loophp\lambada\Compose;

$data = [1, 2, 3];

Map::off()(Id::off())($data) === Id::off()($data); // true

$sub20 = static function ($x) {
    return $x - 20;
};

$times7 = static function ($x) {
    return $x * 7;
};

Map::off()(Compose::off()($sub20, $times7))($data) === Compose::off()(Map::off()($sub20), Map::off()($times7))($data); // true