@@ -7,13 +7,13 @@ |
||
| 7 | 7 | $scores = new F\Collection(range(1, 10)); |
| 8 | 8 | |
| 9 | 9 | $x = $scores |
| 10 | - ->map(function ($x) { |
|
| 10 | + ->map(function($x) { |
|
| 11 | 11 | return $x * 3; |
| 12 | 12 | }) |
| 13 | - ->filter(function ($x) { |
|
| 13 | + ->filter(function($x) { |
|
| 14 | 14 | return $x % 2 === 0; |
| 15 | 15 | }) |
| 16 | - ->reduce(function ($acc, $x) { |
|
| 16 | + ->reduce(function($acc, $x) { |
|
| 17 | 17 | return $acc + $x; |
| 18 | 18 | }); |
| 19 | 19 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | function flatten(array $xs) |
| 15 | 15 | { |
| 16 | - return array_reduce($xs, function ($carry, $x) { |
|
| 16 | + return array_reduce($xs, function($carry, $x) { |
|
| 17 | 17 | if (is_array($x)) { |
| 18 | 18 | return array_merge($carry, flatten($x)); |
| 19 | 19 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | { |
| 14 | 14 | $args = func_get_args(); |
| 15 | 15 | |
| 16 | - $dropwhile = function (callable $condition, array $xss) { |
|
| 16 | + $dropwhile = function(callable $condition, array $xss) { |
|
| 17 | 17 | if ([] === $xss) { |
| 18 | 18 | return []; |
| 19 | 19 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | { |
| 13 | 13 | $args = func_get_args(); |
| 14 | 14 | |
| 15 | - $takewhile = function (callable $condition, array $xss) { |
|
| 15 | + $takewhile = function(callable $condition, array $xss) { |
|
| 16 | 16 | if ([] === $xss) { |
| 17 | 17 | return []; |
| 18 | 18 | } |
@@ -16,12 +16,12 @@ |
||
| 16 | 16 | { |
| 17 | 17 | $args = func_get_args(); |
| 18 | 18 | |
| 19 | - return array_reduce($args, function ($carry, $fn) { |
|
| 19 | + return array_reduce($args, function($carry, $fn) { |
|
| 20 | 20 | if (null === $carry) { |
| 21 | 21 | return $fn; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - return function () use ($carry, $fn) { |
|
| 24 | + return function() use ($carry, $fn) { |
|
| 25 | 25 | $args = func_get_args(); |
| 26 | 26 | |
| 27 | 27 | return $fn(call_user_func_array($carry, $args)); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | function always($x) |
| 13 | 13 | { |
| 14 | - return function () use ($x) { |
|
| 14 | + return function() use ($x) { |
|
| 15 | 15 | return $x; |
| 16 | 16 | }; |
| 17 | 17 | } |
@@ -19,10 +19,10 @@ |
||
| 19 | 19 | |
| 20 | 20 | $pivot = head($xss); |
| 21 | 21 | $xs = tail($xss); |
| 22 | - $left = array_filter($xs, function ($x) use ($pivot) { |
|
| 22 | + $left = array_filter($xs, function($x) use ($pivot) { |
|
| 23 | 23 | return $x < $pivot; |
| 24 | 24 | }); |
| 25 | - $right = array_filter($xs, function ($x) use ($pivot) { |
|
| 25 | + $right = array_filter($xs, function($x) use ($pivot) { |
|
| 26 | 26 | return $x > $pivot; |
| 27 | 27 | }); |
| 28 | 28 | |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | $args = func_get_args(); |
| 10 | 10 | |
| 11 | - $deleteat = function ($n, array $xs) { |
|
| 11 | + $deleteat = function($n, array $xs) { |
|
| 12 | 12 | if ($n > 0) { |
| 13 | 13 | return array_merge(take($n, $xs), drop($n + 1, $xs)); |
| 14 | 14 | } |