Hi,

On Jun 6, 11:15 pm, Brian Wolf <brw...@gmail.com> wrote:

> hmm.. not really 'printing', just trying to save what might be any
> binary data in a clojure map, as I would save say, want to save gif
> images  in a java or C array. at least that's the analogy I am
> comparing this case to.

This is the problem with analogies: they are sometimes wrong. The
contents of the map are actually printed and not stored in some
binary format.

> So, at least acording to this example, print-dup has to be extended
> to every possible data type that might be stored in a map in order
> to save it to a file (?)

Yes. How could it know how to print a string, which recreates an
arbitrary class when reading the code again? You either need some
convention (like beans) or some interface like print-dup or
Serializable.

Clojure's collections will also implement the latter, but in case
you have some third party object in your collection which doesn't
you didn't gain anything.

Using plain print-dup for serialisation is a bad idea anyway. It
explodes your data.

(binding [*print-dup* true]
  (println (zipmap (range 10) (repeat {:a :b}))))

Reading the string back in will give you ten maps where you had
only one before. This might or might not be of importance to you.

Sincerely
Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to