Thanks Mark and Alex! Ambrose
On Fri, Nov 1, 2013 at 12:20 PM, Mark Engelberg <mark.engelb...@gmail.com>wrote: > I'm pleased to announce the latest version of clojure.math.combinatorics. > https://github.com/clojure/math.combinatorics > > clojure.math.combinatorics is a library of functions to generate > permutations, subsets, combinations, cartesian products, and selections of > collections. > > NEW TO 0.0.6 -- partitions > > Alex Engelberg has contributed a new `partitions` function. > > => (pprint (partitions [1 2 3 4])) > (([1 2 3 4]) > ([1 2 3] [4]) > ([1 2 4] [3]) > ([1 2] [3 4]) > ([1 2] [3] [4]) > ([1 3 4] [2]) > ([1 3] [2 4]) > ([1 3] [2] [4]) > ([1 4] [2 3]) > ([1] [2 3 4]) > ([1] [2 3] [4]) > ([1 4] [2] [3]) > ([1] [2 4] [3]) > ([1] [2] [3 4]) > ([1] [2] [3] [4])) > > There are a few other Clojure implementations of `partitions` bouncing > around the net. This implementation is significantly more advanced, > boasting the following features: > > 1. Uses a sophisticated iterative algorithm, faster than the standard > recursive approach. > 2. Special support for collections with duplicate items. > 3. Support for efficiently generating partitions restricted to some > minimum and/or maximum number of sets in the partition. > > Enjoy! > > P.S. A lot of people don't realize it, but the existing `permutations` > function also has special handling for efficiently processing collections > with duplicate items. For example: > => (permutations [1 1 2 2]) > ([1 1 2 2] [1 2 1 2] [1 2 2 1] [2 1 1 2] [2 1 2 1] [2 2 1 1]) > > -- > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.