Re: How to save lists containing functions to disk



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.
.



Relevant Pages

  • Re: Add item to Combo Box?
    ... >have to learn the ways of the API. ... You must remember that these posts will be around ... This *is* a friendly environment and don't let my comments ... because it is a learning experience for all. ...
    (microsoft.public.vb.general.discussion)
  • Re: Sudo: local root compromise with krb5 enabled
    ... My program respects the $ALLOW_ROOT_COMPROMISE environment ... You may think root compromises are bad, ... when one's security software has an "API" consisting of hundreds ... but not documented in the API documentation! ...
    (Bugtraq)
  • Re: recursive folders?
    ... My own library functions use both FSO and the ... >API, depending on how important the speed of the function is. ... >work in a controlled environment where I can quickly restore WSR. ...
    (microsoft.public.vb.general.discussion)
  • Re: old school com on Win2k3 Adv Server?
    ... it doesn't seem to have access to the environment can't ... On this particular box the underlying API fails after being ... Brian Muth wrote: ... > COM objects work just fine on Win2003. ...
    (microsoft.public.vc.atl)
  • Re: Tcl 8.4.6 Source - Compiling under Windows Services for Unix.
    ... I guess I would argue that since apps running in the SFU environment (or ... API directly, they are as 'native' as anything else running under Windows. ... The WIN32 and POSIX system interfaces built in to NT operate at the same ... so there is no emulation involved. ...
    (comp.lang.tcl)