On Mon, Aug 10, 2009 at 10:57 PM, Kyle R. Burton <kyle.bur...@gmail.com>wrote:
> On Mon, Aug 10, 2009 at 10:42 PM, Kyle R. Burton<kyle.bur...@gmail.com> > wrote:Sorry, forgot to offer up the inverse of freeze, thaw: > > (defn thaw [bytes] > (with-open [bais (java.io.ByteArrayInputStream. bytes) > ois (java.io.ObjectInputStream. bais)] > (.readObject ois))) > > > Regards, > > Kyle Which in turn gives us this, otherwise sorely lacking from the Java standard library, but much less useful to us Clojurians who tend to mainly use immutable objects: (defn deep-copy [obj] (thaw (freeze obj))) (Object.clone() does a shallow copy and typically isn't as widely available as Serializable.) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---