On Jul 30, 5:03 pm, Chouser wrote:
> Are you aware of *print-dup* ? It causes the printer to
> preserve more of the specific type information than normal
> printing:
>
> user=> (binding [*print-dup* true] (prn (hash-map :a 1, :b 2)))
> {:a 1, :b 2}
> nil
> user=> (binding [*print-dup* true] (prn
> Are you aware of *print-dup* ? It causes the printer to
> preserve more of the specific type information than normal
> printing:
It's one of those things that hasn't yet crept close enough on my
radar for me to absorb. This is the impetus...
> Having said that, it's important to note it doe
On Thu, Jul 30, 2009 at 4:20 PM, Richard Newman wrote:
>
> The scenario here, though, is different: given an *existing* struct-
> map (which prints as {:foo 1 :bar 2} -- not a form), one cannot print
> it in such a way that the struct-map-ness is preserved when it is re-
> read. You can discover t
> The problem is you aren't quoting the forms fed to eval.
That was intentional. Imagine a broader example, where I want to read
in a form, examine/print/etc. parts of it, then evaluate it.
Printing a struct-map produces map syntax.
Reading the output produces a literal map with unevaluated c
The problem is you aren't quoting the forms fed to eval.
This:
(eval (struct foo 1 2))
mean this:
(eval {:bar 1 :baz 2})
And small literal maps are eval'd as a PersistentArrayMap
Now if instead you do:
(eval '(struct foo 1 2))
then eval is eval'ing the form (struct foo 1 2), thus t