Hi, I am interested in Clojures approach to managing state and its use of immutable values. I believe immutable values will make the life of programmers easier and I'm trying to figure out how I can simplify my OO code by using more immutable values.
In particular, I am wondering how I can model notes that can belong to a category. So a note is a piece of text and a reference to a category. A category is just a name. However, both notes and categories are entities (the identity is *not* defined by their value). So it is perfectly ok to have two notes with the same text and same category, yet they are different notes. The data structure holding these things together (lets call it NoteDb) has a list of categories and a list of notes. And I want to be able to say things like change the text of a note to this. And when I change the name of a category, all notes belonging to that category know that the category name has changed. I also want to be able to get all notes belonging to a category. Should I model this as a list of refs? Is there another way to think about this problem that I don't see because I have mainly done work in OO languages. -- Rickard Lindberg -- 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