mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-22 13:24:46 +00:00
added special form: undef
This commit is contained in:
parent
07f9c7af8e
commit
86cba08088
@ -276,6 +276,7 @@ or | yes | `(or false 0 1)` | `1` | Return the first value that evaluates to
|
||||
quote | yes | | | See the section Quoting.
|
||||
quasiquote | yes | | | See the section Quoting.
|
||||
quasiquote-expand | yes | | | See the section Quoting.
|
||||
undef | yes | `(undef myFn)` | `<function>` | Remove a definition from the current environment. Return the removed value.
|
||||
|
||||
## Functions
|
||||
|
||||
|
@ -367,6 +367,16 @@ class Evaller
|
||||
}
|
||||
|
||||
return $this->quasiquote($astData[1]);
|
||||
} elseif ($symbolName == 'undef') {
|
||||
if ($astLength != 2) {
|
||||
throw new MadLispException("undef requires exactly 1 argument");
|
||||
}
|
||||
|
||||
if (!($astData[1] instanceof Symbol)) {
|
||||
throw new MadLispException("first argument to undef is not symbol");
|
||||
}
|
||||
|
||||
return $env->unset($astData[1]->getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user