Skip to content

Instantly share code, notes, and snippets.

@josecanhelp
Last active December 7, 2019 05:27
Show Gist options
  • Save josecanhelp/18340b7471fff0a48ebf679bbd366c93 to your computer and use it in GitHub Desktop.
Save josecanhelp/18340b7471fff0a48ebf679bbd366c93 to your computer and use it in GitHub Desktop.
<?php
require __DIR__.'/vendor/autoload.php';
use Vector\Lib\Arrays;
use Vector\Lib\Math;
use Vector\Lib\Lambda;
use Vector\Core\Module;
$input = [148454, 118001, 98851.....];
$fuelCalc = Lambda::compose(Math::subtract(2), Module::curry('floor'), Math::divide(3));
$result = Math::sum(Module::curry(Arrays::map($fuelCalc))($input));
var_dump($result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment