From bfd0947112a317542d77959f0ae224f8e256f9a6 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 4 Aug 2015 08:45:00 -0700 Subject: * 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. --- txr.1 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'txr.1') 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 ) -- cgit v1.2.3