[CM] (sub)environments and object->string with :readable
chris.actondev at gmail.com
Thu Jul 30 02:32:49 PDT 2020
Indeed it works, but the output of :readable grows out of hand.
Here is a snippet. Imagine if there were way more definitions (and nested
(let ((a '(1 2 3)))
(let ((+documentation+ "Makes some state with b"))
(let ((b '(1 2 3)))
(define state ((*lib* 'make-state)))
;; => (inlet 'a (1 2 3))
;; perfect, but not eval'able
(object->string state :readable)
;; (sublet (sublet (sublet (inlet :make-state (lambda () (let ((a '(1 2
3))) (curlet))) :make-state-2 (let ((+documentation+ \"Makes some state
with b\")) (lambda () (let ((b '(1 2 3))) (curlet))))))) :a (list 1 2 3))
So the :readable version essentially gives me essentially the source of
Also, I realize now that in my application the problem that I faced was the
"format ~W.." output was trimmed because it was too long.
>From one hand indeed it works as expected (creating a complete definition).
But on the other hand this is unusable for saving state. (imagine storing
all of this in some database for example.. it's mostly noise)
For now actually my problem is solved, since I'm defining the state in the
rootlet, but this thing bugs me.
On Thu, 30 Jul 2020 at 02:19, <bil at ccrma.stanford.edu> wrote:
> The previous example would have worked; I thought
> you were unhappy that it was not simple, but it is
> intended for s7's use. object->string with :readable
> and format with ~W are the built-in ways to serialize
> most s7 objects.
> (The complexity of the previous example came from s7's
> attempt to preserve the outlet chain, but the outer
> let refers back to the inner one -- a circular reference).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Cmdist