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 the error
"java.lang.IllegalArgumentException: No matching method found: create
(NO_SOURCE_FILE:0)" when I run it in the REPL:

(import
  '(java.io StringReader PushbackReader))

(defstruct Y :a :b)
(def y (struct Y "a" "b"))

(defn serialize [x]
  (binding [*print-dup* true] (pr-str x)))

(defn deserialize [x]
  (let [r (new PushbackReader (new StringReader x))]
    (read r)))

(deserialize (serialize y))


What am I doing wrong here?

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