Apologies for the awful title, I'm not too sure how to describe it in words but here is what I mean. If you know a better way to phrase this please let me know.
Suppose I had 2 lists, of equal length.
[a, b, c] [x, y, z]
I want to create the list
[[a, y, z], [b, x, z], [c, x, y]]
Essentially for every element of list1, I want the 2 elements at different indexes to the first element in list2.
so for "a" at index 0, the other 2 are "y" at index 1 and "z" at index 2.
I'm pretty sure I know how to do it using indexes, however, I know that that's not very efficient and wanted to see if there is a more functional solution out there.
Thank you.
question from:https://stackoverflow.com/questions/66050529/haskell-combine-the-elements-of-2-lists-at-different-indexs