summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-12-08 21:25:41 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-12-08 21:25:41 -0800
commitddbf5c05006e113608ac3c57f6d403bdebcc20a5 (patch)
tree3b4c1b235b9b10738a28efa31efec5959eba6fa1
parentfd1473136898716cecf77de5a029c58e98f2a682 (diff)
downloadtxr-ddbf5c05006e113608ac3c57f6d403bdebcc20a5.tar.gz
txr-ddbf5c05006e113608ac3c57f6d403bdebcc20a5.tar.bz2
txr-ddbf5c05006e113608ac3c57f6d403bdebcc20a5.zip
Adding mboundp and mmakunbound.
* eval.c (mboundp, mmakunbound): New static functions. (eval_init): Registering mboundp and mmakunbound intrinsics. * txr.1: Documenting new functions. Also clarifying that fboundp checks for an operator macro binding (not a symbol macro binding).
-rw-r--r--eval.c14
-rw-r--r--txr.114
2 files changed, 25 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index 9e2b73e1..c2c62b6c 100644
--- a/eval.c
+++ b/eval.c
@@ -3710,6 +3710,11 @@ val fboundp(val sym)
gethash(op_table, sym), t);
}
+static val mboundp(val sym)
+{
+ return tnil(lookup_mac(nil, sym));
+}
+
val special_operator_p(val sym)
{
return if2(gethash(op_table, sym), t);
@@ -3732,6 +3737,13 @@ static val fmakunbound(val sym)
return sym;
}
+static val mmakunbound(val sym)
+{
+ lisplib_try_load(sym),
+ remhash(top_mb, sym);
+ return sym;
+}
+
static val range_func(val env, val lcons)
{
cons_bind (from, to_step, env);
@@ -4977,8 +4989,10 @@ void eval_init(void)
reg_fun(intern(lit("symbol-function"), user_package), func_n1(symbol_function));
reg_fun(intern(lit("boundp"), user_package), func_n1(boundp));
reg_fun(intern(lit("fboundp"), user_package), func_n1(fboundp));
+ reg_fun(intern(lit("mboundp"), user_package), func_n1(mboundp));
reg_fun(intern(lit("makunbound"), user_package), func_n1(makunbound));
reg_fun(intern(lit("fmakunbound"), user_package), func_n1(fmakunbound));
+ reg_fun(intern(lit("mmakunbound"), user_package), func_n1(mmakunbound));
reg_fun(intern(lit("special-operator-p"), user_package), func_n1(special_operator_p));
reg_fun(intern(lit("special-var-p"), user_package), func_n1(special_var_p));
reg_fun(sys_mark_special_s, func_n1(mark_special));
diff --git a/txr.1 b/txr.1
index aa281265..eb328c41 100644
--- a/txr.1
+++ b/txr.1
@@ -13012,10 +13012,11 @@ functions. If a nonexistent place is deleted, the prior value yielded
by the deletion is deemed to be
.codn nil .
-.coNP Functions @ boundp and @ fboundp
+.coNP Functions @, boundp @, fboundp and @ mboundp
.synb
.mets (boundp << symbol )
.mets (fboundp << symbol )
+.mets (mboundp << symbol )
.syne
.desc
.code boundp
@@ -13028,8 +13029,15 @@ environment, otherwise
.code fboundp
returns
.code t
-if the symbol has a function or macro binding in the global
-environment, or if it is an operator, otherwise
+if the symbol has a function or operator macro binding in the global
+environment, or if it is a special operator, otherwise
+.codn nil .
+
+.code mboundp
+returns
+.code t
+if the symbol has an operator macro binding in the global environment,
+otherwise
.codn nil .
.coNP Functions @ makunbound and @ fmakunbound