Lazy-seqs also seem to behave:
user=> (serialize! (map inc [1 2 3 4]) "TEST4")
nil
user=> (.hashCode (deserialize! "TEST4.ser"))
986115
Jim
On 10/10/12 15:14, Jim foo.bar wrote:
I can confirm I am seeing the behavior you describe under Clojure 1.4...
user=> (serialize! [1 2 3 4 5] "TEST")
nil
user=> (.hashCode (deserialize! "TEST.ser"))
29615266
user=> (serialize! ["a" "b" "c" "d"] "TEST2")
nil
user=> (.hashCode (deserialize! "TEST2.ser"))
3910595
user=> (serialize! '("a" "b" "c" "d") "TEST3")
nil
user=> (.hashCode (deserialize! "TEST3.ser"))
0
Can you not use vectors instead if lists? Vectors seem to behave...
(defn serialize!
"Serialize the object b on to the disk using Java serialization.
Filename needs no extension - it will be appended (.ser)."
[b fname]
(with-open [oout (java.io.ObjectOutputStream.
(java.io.FileOutputStream. (str fname ".ser")))]
(.writeObject oout b)))
(defn deserialize!
"Deserializes the object in file f from the disk using Java
serialization."
[fname]
(let [upb (promise)] ;waiting for the value shortly
(with-open [oin (java.io.ObjectInputStream.
(java.io.FileInputStream. fname))]
(deliver upb (.readObject oin)))
@upb))
Jim
On 10/10/12 14:55, N8Dawgrr wrote:
I don't think that's a realistic option for me. I have java objects
embedded in the Clojure forms, and the graph is pretty big.
On Wednesday, October 10, 2012 2:02:45 PM UTC+1, Stuart Sierra wrote:
I would recommend serializing as strings via pr/read over Java
serialization, but this still sounds like a legitimate bug.
-S
--
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
--
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