I\'m trying to write a haskell function that takes in two lists of integers and generates a list with elements that have been taken alternatingly from the two lists.
I
I will assume that this is homework. Provided that you can create the following list (as you said):
[(1,4),(2,5),(3,6)]
... you can solve it with 2 functions:
(a, b)
into a list [a, b]
. Try using pattern matching! This function needs to be applied (aka. mapped) over all elements of the list you have.[[1,4],[2,5],[3,6]]
, so you need a function for concatenating the sublists into one big list.There are of course other, maybe superior, ways to solve this problem, but it might be a good idea to continue with your original approach.