summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-02-22 21:52:27 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-02-22 21:52:27 -0800
commit41cca60e490bd252ce4382fb3edc93281e20b906 (patch)
treee8dcbfa0091115418902d643be858237d23c5ab9 /eval.c
parent9975c154020b0015700e6de15e61b66ddb58ceab (diff)
downloadtxr-41cca60e490bd252ce4382fb3edc93281e20b906.tar.gz
txr-41cca60e490bd252ce4382fb3edc93281e20b906.tar.bz2
txr-41cca60e490bd252ce4382fb3edc93281e20b906.zip
* eval.c (symbol_function): Retrieve the global macro binding if the
function lookup fails, and if that fails, retrieve the special operator binding. (fboundp): Report t if there is a global macro binding. * txr.1: Use "global" rather than "toplevel". Added note that the fun operator doesn't see macro bindings. Documented that symbol-function and fboundp see global macro bindings, and that symbol-function can retrieve a special operator binding.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index 9a30b391..baa0ed73 100644
--- a/eval.c
+++ b/eval.c
@@ -2522,7 +2522,10 @@ static val symbol_value(val sym)
static val symbol_function(val sym)
{
- return cdr(lookup_fun(nil, sym));
+ uses_or2;
+ return or2(cdr(or2(lookup_fun(nil, sym),
+ lookup_mac(nil, sym))),
+ gethash(op_table, sym));
}
static val boundp(val sym)
@@ -2532,8 +2535,8 @@ static val boundp(val sym)
static val fboundp(val sym)
{
- return if3(lookup_fun(nil, sym), t,
- if3(gethash(op_table, sym), t, nil));
+ return if2(lookup_fun(nil, sym) || lookup_mac(nil, sym) ||
+ gethash(op_table, sym), t);
}
static val rangev_func(val env, val lcons)