Re: How to save lists containing functions to disk
- From: Pascal Bourguignon <spam@xxxxxxxxxxxxxxxx>
- Date: Wed, 23 Nov 2005 11:05:10 +0100
Pascal Bourguignon <spam@xxxxxxxxxxxxxxxx> writes:
> But environments are opaque in Common Lisp, so you cannot do anything
> portably. If you have the good taste of using an implementation that
> gives an API to access the environment, then you could generate
> additionnal functions in the closure to let you retrieve the values in
> the closure at run-time, when you print the function; something like:
>
>
> (cl:defmacro defun (&environment env name args &body body)
> `(progn
> (compile (cl:defun ,name ,args ,@body))
> (setf (gethash (fdefinition ',name) *function-sources*)
> (lambda ()
> (list 'let
> ,(cons 'list
> (%map-env ; IMPLEMENTATION SPECIFIC!
> (lambda (var)
> (list 'list (list 'quote var) var))
> env))
> '(defun ,name ,args ,@body))))
> ',name))
I forgot to mention, for more fun, the environment includes macrolets,
lexical functions (flet & labels), and symbol-macrolets, if you want
to be complete...
--
__Pascal Bourguignon__ http://www.informatimago.com/
You never feed me.
Perhaps I'll sleep on your face.
That will sure show you.
.
- References:
- How to save lists containing functions to disk
- From: javuchi
- Re: How to save lists containing functions to disk
- From: Pascal Bourguignon
- How to save lists containing functions to disk
- Prev by Date: Re: outputing #\Tab the C way
- Next by Date: Re: asdf-install problem
- Previous by thread: Re: How to save lists containing functions to disk
- Next by thread: Re: How to save lists containing functions to disk
- Index(es):
Relevant Pages
|