[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lexical closures
Quick questions for the LISP gurus out there.
(I am using the latest and greatest Allegro CL (4.0.1?))
I am interested in creating lexical closures so that I can save some
state variables and for later use in resuming some functions.
I know how to do this with the traditional #'(lambda ... syntax.
However, I was just trying to do the same thing with labels, e.g.:
(defun bar (x)
(labels ((fn1 ()
(setq x (foo x))
(values x #'fn1)))
(fn1)))
The idea being that later on I can resume calling fn1.
It occurs to me that may not be doing what I want (especially since
it seemed to be working a little bit, but lately I can't even call
my function when I compile it... although interpreted seems to work???).
Anyway. Does the labels macro perform a lexical closure? Does this
make sense?
Thanks for any clues as to what is really going here (both generally
in LISP and specifically in Allegro CL).
Joel Riedesel
jriedesel@den.mmc.com