On Sat, 28 Apr 2007, Hans van Thiel wrote: > Thanks again for the help, and, to follow up, this now does what I > need.. > > -- partitions a list according to an equivalence relation > > partition1 :: (a -> a -> Bool) -> [a] -> ([a],[a]) > partition1 eq ls = partition ((head ls) `eq`) ls > -- > partitionBy :: (a -> a -> Bool) -> [a] -> [[a]] > partitionBy eq [] = [] > partitionBy eq ls = > (fst x):(partitionBy eq (snd x)) where > x = partition1 eq ls
partitionBy is essentially a List.unfoldr _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe