mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-22 21:35:03 +00:00
tco for case
This commit is contained in:
parent
cb1a03e9bd
commit
8cf2dbeeec
@ -48,13 +48,15 @@ class Evaller
|
||||
for ($i = 1; $i < $ast->count() - 1; $i += 2) {
|
||||
$test = $this->eval($ast->get($i), $env);
|
||||
if ($test == true) {
|
||||
return $this->eval($ast->get($i + 1), $env);
|
||||
$ast = $ast->get($i + 1);
|
||||
continue 2; // tco
|
||||
}
|
||||
}
|
||||
|
||||
// Last value, no test
|
||||
if ($ast->count() % 2 == 0) {
|
||||
return $this->eval($ast->get($ast->count() - 1), $env);
|
||||
$ast = $ast->get($ast->count() - 1);
|
||||
continue; // tco
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user