On Jan 26, 12:46 pm, jleehurt wrote:
> When I try using deftype I get the following error:
> java.lang.IllegalArgumentException: No method in multimethod 'print-
> dup' for dispatch value: class user.Y__5
That's probably a bug. It should work when *print-dup* is false.
-SS
--
You received thi
Hi Stuart,
When I try using deftype I get the following error:
java.lang.IllegalArgumentException: No method in multimethod 'print-
dup' for dispatch value: class user.Y__5
Do I have to supply my own print-dup for the new type for this to
work?
Here is the code:
(import
'(java.io StringReader
On Jan 26, 11:40 am, jleehurt wrote:
> Thanks Anders. I'm not sure why, but it appears that read does not
> support structmaps.
That is correct, read does not work with structmaps, because it
doesn't know how to resolve the struct definition while reading.
deftype, the replacement for structmaps
Thanks Anders. I'm not sure why, but it appears that read does not
support structmaps. The following works with a hashmap:
(import
'(java.io StringReader PushbackReader))
(def y (hash-map :a "a" :b "b"))
(defn serialize [x]
(binding [*print-dup* true] (pr-str x)))
(defn deserialize [x]
(l
Hello
I'm using:
(defstruct db
:file
:data)
(defn write-db [db]
(let [path (str (:file db) ".tmp")]
(binding [*out* (java.io.FileWriter. path)]
(prn (:data db)))
(. (new File path) renameTo (new File (:file db)
(defn read-db [fname]
(try
(let [object (read-string (s
Hi all,
I am writing a distributed program using Clojure. I am trying to write
some code to pass structs around to different nodes on the network by
serializing and deserializing strings. I do not fully understand how
to use *print-dup* and read to do this.
The last line of the following gives th