#82 mishandling of lambda expression

lisp error
closed-fixed
clisp (525)
5
2002-01-27
2002-01-27
No

Compiling a file containing

(defmacro bugtest (arg)
`(* (,arg 10) 20))

(bugtest (lambda (x)
(* x 10)))

results in the following error:

*** - COMPILER-MACRO-FUNCTION: function name should be
a symbol, not (LAMBDA (X) (* X 10))

The following patch fixes this for me.

Index: compiler.lisp

RCS file: /cvsroot/clisp/clisp/src/compiler.lisp,v
retrieving revision 1.63
diff -u -r1.63 compiler.lisp
--- compiler.lisp 2002/01/09 22:06:12 1.63
+++ compiler.lisp 2002/01/27 05:45:03
@@ -7473,6 +7473,9 @@
;; signal an error when it is not an number
;; returns 2 values - value and constant-p
(defun c-constant-number (form)
+ (when (and (consp form)
+ (lambda-form-p (car form)))
+ (return-from c-constant-number (values form nil)))
(let ((expanded (macroexpand-form form)))
(if (c-constantp expanded)
(let ((val (c-constant-value expanded)))

Discussion

  • Dave MacDonald

    Dave MacDonald - 2002-01-27

    Logged In: YES
    user_id=21756

    I forgot to say that this problem occurred with CVS CLISP.

    -Dave

     
  • Sam Steingold

    Sam Steingold - 2002-01-27
    • status: open --> closed-fixed
     
  • Sam Steingold

    Sam Steingold - 2002-01-27

    Logged In: YES
    user_id=5735

    thank you for your bug report.
    the bug has been fixed in the CVS tree.
    you can either wait for the next release (recommended)
    or check out the current CVS tree (see http://clisp.cons.org\)
    and build CLISP from the sources (be advised that between
    releases the CVS tree is very unstable and may not even build
    on your platform).

     

Log in to post a comment.