Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function generateLet($program) |
||
29 | { |
||
30 | // bindings is an array of pairs: [[param, value], [param, value]] |
||
31 | list($_letStar, $bindings) = $program; |
||
32 | $body = \array_slice($program, 2); |
||
33 | |||
34 | if (\count($bindings) > 1) { |
||
35 | return [$this->letSymbol, [$bindings[0]], |
||
36 | $this->generateLet(array_merge( |
||
37 | [$this->letStarSymbol, \array_slice($bindings, 1)], |
||
38 | $body))]; |
||
39 | } |
||
40 | |||
41 | return array_merge( |
||
42 | [$this->letSymbol, [$bindings[0]]], |
||
43 | $body); // unpack the body of let into the lambda exp |
||
44 | |||
51 | } |