From d7e61d9fd142b867388f930907a099e7b132e76a Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 3 May 2020 20:09:25 -0700 Subject: symbol-function: bugfix: expand lambda expression. * eval.c (lookup_fun): A lambda expression must be expanded before being turned into a function. * txr.1: Documented. --- eval.c | 2 +- txr.1 | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/eval.c b/eval.c index 7b3a765d..3eea86bc 100644 --- a/eval.c +++ b/eval.c @@ -579,7 +579,7 @@ val lookup_fun(val env, val sym) } else if (car(sym) == macro_s) { return lookup_mac(nil, cadr(sym)); } else if (car(sym) == lambda_s) { - return cons(sym, func_interp(env, sym)); + return cons(sym, func_interp(env, expand(sym, nil))); } else { return nil; } diff --git a/txr.1 b/txr.1 index bc9096c4..54ecbcce 100644 --- a/txr.1 +++ b/txr.1 @@ -16996,7 +16996,8 @@ If a .code lambda expression is passed to .codn symbol-function , -then the function implied by that expression is returned. +then the expression is macro-expanded and if that is successful, the function +implied by that expression is returned. It is unspecified whether this function is interpreted or compiled. The -- cgit v1.2.3