-- Sergio and Michael -- Tue Apr 12 17:02:35 PDT 2011 -- Determine whether there are duplicate values in a list import SetFunctions -- prototypical implementation duplND l = not (isEmpty (set1 aux l)) where aux (_++[x]++_++[x]++_) = success -- production implementation duplD [] = False duplD (x:xs) = aux xs where aux (y:ys) = x==y || aux ys || duplD xs aux [] = False --tests testND = map duplND [[1,2,3],[2,3,2,4]] testD = map duplD [[1,2,3],[2,3,2,4]]