
8 Apr
2008
8 Apr
'08
2:17 p.m.
On Tue, Apr 8, 2008 at 10:24 AM, Jackm139
import List
same :: [[Char]] -> [[Char]] -> Bool same [xs] [ys] = map (normalize) [[xs]] == map (normalize) [[ys]]
normalize :: [String] -> [String] normalize [xs] = [(sort (nub xs))]
Your pattern binding [xs] and [ys] says to only match when the list contains one element. Otherwise, you get a pattern-matching failure at run-time. Use "normalize xs" to match a list of strings, and "same xs ys" to match lists of lists. xs and ys will have different types with those patterns, but you'll get it. Justin