I need to split a list into a list of all possible tuples, but I\'m unsure of how to do so.
For example:
pairs [\"cat\",\"dog\",\"mouse\"]
My approach, which is somewhat similar to others'. It doesn't require Eq.
Eq
allpairs :: [t] -> [(t,t)] allpairs [] = [] allpairs [_] = [] allpairs (x:xs) = concatMap (\y -> [(x,y),(y,x)]) xs ++ allpairs xs