summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-04 08:45:00 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-04 08:45:00 -0700
commitbfd0947112a317542d77959f0ae224f8e256f9a6 (patch)
tree344af6e6e4270da06ae56e8bf985c684a74ee1b3 /txr.1
parent0abbda4a698bc0f3eb531c6578469c3dff65ad57 (diff)
downloadtxr-bfd0947112a317542d77959f0ae224f8e256f9a6.tar.gz
txr-bfd0947112a317542d77959f0ae224f8e256f9a6.tar.bz2
txr-bfd0947112a317542d77959f0ae224f8e256f9a6.zip
* eval.c (func_get_name): New function.
(bind_args): Include the entire context form in argument mismatch errors. (apply): Include the function name, or else source code if it has no name, in argument mismatch erors. (eval_init): Register func-get-name intrinsic. * eval.h (func_get_name): Declared. * txr.1: Documented func-get-name.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.129
1 files changed, 29 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index cefd833e..1975177c 100644
--- a/txr.1
+++ b/txr.1
@@ -12691,6 +12691,35 @@ which must be an interpreted function. The source code form has the syntax
.meti >> ( name < arglist << body-form *) .
.cble
+.coNP Function @ func-get-name
+.synb
+.mets (func-get-form << func <> [ env ])
+.syne
+.desc
+The
+.code func-get-name
+tries to resolve the function object
+.meta func
+to a name. If that is not possible, it tries to resolve it to
+a lambda expression denoting the source code form of the function.
+If neither a name nor code can be found, then
+.code nil
+is returned.
+
+The name or code information is searched in the environment
+specified by
+.meta env
+and if it is not found there, it similarly searches through the chain
+of parent environments, and finally the global environment.
+If
+.meta env
+is omitted, then only the global environment is searched.
+
+If a function binding is found which associates a symbol
+with
+.meta function
+then that symbol is returned. Variable bindings are not considered.
+
.coNP Function @ func-get-env
.synb
.mets (func-get-env << func )