Last active
December 7, 2019 05:27
-
-
Save josecanhelp/18340b7471fff0a48ebf679bbd366c93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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