Re: [Haskell-cafe] efficient and/or lazy partitions of a multiset

2007-05-22 Thread Henning Thielemann
On Mon, 21 May 2007, Greg Meredith wrote: HC-er's, Find below some simple-minded code from a naive Haskeller for generating all partitions of a multiset about which i have two questions. mSplit :: [a] - [([a], [a])] mSplit [x] = [([x],[])] What about [] ? See

[Haskell-cafe] efficient and/or lazy partitions of a multiset

2007-05-21 Thread Greg Meredith
HC-er's, Find below some simple-minded code from a naive Haskeller for generating all partitions of a multiset about which i have two questions. mSplit :: [a] - [([a], [a])] mSplit [x] = [([x],[])] mSplit (x:xs) = (zip (map (x:) lxs) rxs) ++ (zip lxs (map (x:) rxs))