mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-26 15:14:12 +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.
|
quote | yes | | | See the section Quoting.
|
||||||
quasiquote | yes | | | See the section Quoting.
|
quasiquote | yes | | | See the section Quoting.
|
||||||
quasiquote-expand | 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
|
## Functions
|
||||||
|
|
||||||
|
@ -367,6 +367,16 @@ class Evaller
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->quasiquote($astData[1]);
|
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