Hi, 2010/7/28 WoodHacker <ramsa...@comcast.net>
> The confusion over type and instance was a sloppy example. Sorry. > > But in your solution I'm confused by one thing. You create and > instance of Foo in the let and then assoc the new value of List1 to > it. > This has two problems. One is that the loaded data is not > permanent. The other is that there is no way to add List2 to the > MyFoo record. > > (I've decided to not use MyFoo at all. Instead I have a (def List1 > (ref nil)) defined and then do a ref-set to it when the data is > loaded. This seems > much simpler and works. I then can do a def for List2, List3, etc.) > > It seem to me there should be some way to load a record at run time > without breaking the immutability laws. Once the dynamic data is > loaded, the record becomes immutable and will never be changed > again. It's unrealistic to imagine that we always know at compile > time what the values of a record will be. > Here a record is no different than any other persistent datastructure: you must "build" you data inside-out: first the leaves, then the parents, etc. So in your case, you should first "build" list1 and list2, and then you can build an instance of MyFoo : (MyFoo. list1 list2). There's something coming around the corner, for post 1.2, which used to be named "cells" on IRC, and is now named "Pods" by Rich, which will enable to isolate an "island of mutation" for the purpose of efficiently creating an immutable value in several steps, from one or many threads (aka "processes"). Maybe this could address some of the issues you're seeing, maybe not. HTH, -- Laurent -- 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