
nub has a couple advantages over the n log n version, the main one being that it only requires an 'Eq' constraint, not an 'Ord' one. another being that it is fully lazy, it produces results even for an infinite list. a third is that the results come out in the order they went in. That said, I have a 'snub' (sorted nub) routine I use pretty commonly as well defined in the standard way. If you have something like setnub xs = f Set.empty xs where f _ [] = [] f s (x:xs) = if x `Set.member` s then f s xs else f (Set.insert x xs) (x:xs) then you can use 'RULES' pragmas to replace nub with setnub when it is allowed. Though, I have reservations about using RULES to change the order of complexity. John -- John Meacham - ⑆repetae.net⑆john⑈