We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d3d8ed5 commit ed02d42Copy full SHA for ed02d42
src/Pairs.php
@@ -30,15 +30,13 @@ function toString($list)
30
return $list;
31
}
32
33
- $arr = [];
34
- $iter = function ($items) use (&$arr, &$iter) {
35
- if ($items != null) {
36
- $arr[] = toString(car($items));
37
- $iter(cdr($items));
+ $iter = function ($items, array $acc) use (&$iter) {
+ if ($items == null) {
+ return $acc;
38
39
-
+ return $iter(cdr($items), array_merge($acc, toString(car($items))));
40
};
41
- $iter($list);
+ $arr = $iter($list, []);
42
43
return "(" . implode(", ", $arr) . ")";
44
0 commit comments