Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!voder!pyramid!leadsv!laic!vogon!ik From: ik@vogon.laic.uucp (Ik Su Yoo) Newsgroups: comp.lang.lisp Subject: CL and lexical closures Message-ID: <638@laic.UUCP> Date: 26 Jul 89 16:22:02 GMT Sender: news@laic.UUCP Reply-To: ik@.UUCP () Distribution: usa Organization: Lockheed AI Center, Menlo Park, CA Lines: 25 It seems to me like whenever one uses #'(lambda ...), there is an overhead because the form must remember its lexical environment. Although I find these kinds of forms very useful, I still have questions about their cost: 1. How much cost is there for using lexical closures? 2. Is lexical closure always created when using #'(lambda ...), or only when there is a free variable access within the form? If the former, does it save all bindings? 3. [related to 2] Which of the following is more efficient? (defun store-fn (slot-name) (setf (get slot-name 'lookup-fn) #'(lambda (object) (foo object slot-name)))) (defun store-fn (slot-name) (setf (get slot-name 'lookup-fn) (eval `(compile nil #'(lambda (object) (foo object ',slot-name)))))) Thanks in advance for any insights.