Hello dear Community,
I'm trying organize the sequence of tuple in a Haskell List comprehension.
e.g. I got the following List Comprehension:
[ (a,b,c,d) | a <- [0, 50, 100, 150, 200]
, b <- ['a', 'b', 'c']
, c <- [True, False]
, d <- ['A', 'B']
]
and get:
[ (0, 'a', True, 'A'), (0, 'a', True, 'B'), (0, 'a', False, 'A')
, (0, 'a', False, 'B'), (0, 'b', True, 'A'), (0, 'b', True, 'B')
, (0, 'b', False, 'A'), (0, 'b', False, 'B'), (0, 'c', True, 'A')
,(0, 'c', True, 'B'), (0, 'c', False, 'A')..
Now I want the sequence like following:
[ (0, 'a', True, 'A'), (0, 'a', True, 'B'), (0, 'b', True, 'A')
, (0, 'b', True, 'B'), (0, 'c' ,True, 'A'), (0, 'c', True, 'B')
, (0, 'a', False, 'A'), (0, 'a', False, 'B')..
That means:
First a trade off between the capital letters 'A' & 'B', then a trade off between the small letters 'a','b','c', as a penultimate the trade off between the boolean values True, False and finaly the numbers.
Unfortunately I have absolutely no idea how to realize these and i want to know how you can manipulate the sequence of a list with tuple [(a,b,c)].