How to join two lists of lists?

Hi all! I'm trying to join to lists of lists. The problem is, i would like to get a new list of lists of tuples and not list of tuples of lists (that what zip makes). list1 = [[1,2],[3,4],[5,6]] list2 = [[a,b],[c,d],[e,f]] desiredlist = [[(1,a),(2,b)],[(3,c),(4,d)],[(5,e),(6,f)]] Thanks for any help!

On 5/3/05, Khrystyna Mandziy
Hi all! I'm trying to join to lists of lists. The problem is, i would like to get a new list of lists of tuples and not list of tuples of lists (that what zip makes).
list1 = [[1,2],[3,4],[5,6]] list2 = [[a,b],[c,d],[e,f]]
desiredlist = [[(1,a),(2,b)],[(3,c),(4,d)],[(5,e),(6,f)]]
Thanks for any help!
zipWith zip /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862

On Tue, May 03, 2005 at 10:13:04PM +0200, Khrystyna Mandziy wrote:
Hi all! I'm trying to join to lists of lists. The problem is, i would like to get a new list of lists of tuples and not list of tuples of lists (that what zip makes).
list1 = [[1,2],[3,4],[5,6]] list2 = [[a,b],[c,d],[e,f]]
desiredlist = [[(1,a),(2,b)],[(3,c),(4,d)],[(5,e),(6,f)]]
Try this: zipWith zip list1 list2 Best regards Tomasz

Hi all! I'm trying to join to lists of lists. The problem is, i would like to get a new list of lists of tuples and not list of tuples of lists (that what zip makes).
list1 = [[1,2],[3,4],[5,6]] list2 = [[a,b],[c,d],[e,f]]
desiredlist = [[(1,a),(2,b)],[(3,c),(4,d)],[(5,e),(6,f)]]
Prelude> let list1 = [[1,2],[3,4],[5,6]] Prelude> let list2 = [['a','b'],['c','d'],['e','f']] Prelude> zipWith (zip) list1 list2 [[(1,'a'),(2,'b')],[(3,'c'),(4,'d')],[(5,'e'),(6,'f')]] Why do you want to do this?
participants (4)
-
Khrystyna Mandziy
-
robert dockins
-
Sebastian Sylvan
-
Tomasz Zielonka