Am 03.10.2010 09:32, schrieb Alan:
I've got a collection of unique objects, and I need to partition them
into sets. That part's easy enough, but I need to have both of the
following be efficient, and preferably easy:
- Given an object, determine what set it's in
- List all the objects in a given set
In an imperative language this would be fairly simple: create some
empty sets, then iterate over all objects; at each step add the object
to a set, and adjust the object's "parent" pointer to point at the set
it's in.
But in a functional, immutable context the circularity involved seems
to make this really inconvenient: if I create the set first then it
can't point to the object, and if I create the object first it can't
point at its set.
You could use mutable objects:
>
http://download.oracle.com/javase/6/docs/api/java/util/package-summary.html
--
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