If you think about it, the tower of sequence types is like this:

                seq
                 |
            gathered seq
           /            \
         multiset permutation

               \   /
                set

The way to do the various options I pointed out is to mix types: the
keep-likes-with-likes would be (union <permutation> <multiset>).
take-away-all would be (difference <gathered-seq> <set>), while take-
away-some would be (difference <gathered seq> <multiset>).

The problem is once you add seq on top, it gets a little defective, as
Alex pointed out.  (multiset <seq>) is easy, as is (permutation
<gathered-seq>), but there's no unambiguous way of going from a seq to
a permutation or to a gathered seq.  The 'left' side of the tower is
much happier than the right.

It's also hard to sign an interpretation to all the combinations on
the tower; for instance, what is the union of two permutations?  This
needs a little TLC from a category theorist...

Nevertheless, this might be a good way of grouping functionalities
into an API.  The set API can be extended to all these types, and
branch into additional combination operators as it moves up the tower
(with really an infinite number for seqs....).

-- 
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

Reply via email to