From: Brad Miller
Subject: Re: Compiling lexical closures
Date: 
Message-ID: <9359@sol.ARPA>
    Date: 2 May 88 16:28:55 GMT
    From: ······@utep-vaxa.UUCP (Dr. Bernat )


    I am trying to compile a lexical closure in Franz Common LISP and
    keeping getting the "illegal function form" message.  It seems to
    me that I should be able to compile closures.

    For example,
    (defun test (a) (function (lambda (x) (cons x a))))
    (test 5) => returns a lexical closure
    (funcall (test 5) 6) => (6.5) as expected
    but
    (compile nil (test 5)) gives the error message

    Can anyone help?

    Thanks,
    Andrew Bernat
    CS Dept.
    U.Texas @ El Paso
    UUCP ...ut-sally!utep-vaxa!bernat
    BITNET ····@UTEP
    915/747-5470

Try redefining test to:

(defun test (a) (compile nil `(lambda (x) (cons x ,a))))

The problem is that compile doesn't know what to do with a closure, you have
to compile the lambda form.

[I don't have a franz common lisp, this follows from Steele, and works on a
Symbolics]

----
Brad Miller		U. Rochester Comp Sci Dept.
······@cs.rochester.edu {...allegra!rochester!miller}