Search Results

Search found 1 results on 1 pages for 'user1742646'.

Page 1/1 | 1 

  • Splitting list into a list of possible tuples

    - by user1742646
    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"] should result in [("cat","dog"), ("cat","mouse"), ("dog","cat"), ("dog","mouse"), ("mouse","cat"), ("mouse","dog")] I was able to form the first two, but am unsure of how to get the rest. Here's what I have so far: pairs :: [a] -> [(a,a)] pairs (x:xs) = [(m,n) | m <- [x], n <- xs]

    Read the article

1