I am trying to set up some functions to help with a current project I am working on. I am new to Haskell and struggling to implement my desired functions.
I have a list [a] and would like it to output a tuple of four different lists ([b],[b],[b],[b]) where each item in list [a] is successively placed in to the next list in the output tuple. So the first element in the input list [a] goes to the first list [b], the second element in [a] goes to the second list [b], the third element in [a] goes to the third list [b], and so on.
I have tried using chunksOf and splitEvery/splitAt but cannot get the correct output. And help would be greatly appreciated! Thanks!
[a] -> ([a], [a], [a], [a])? So with[a]s as output, not[b]s. Can you share your implementation?foldr (\a ~(x,y) -> (a:y,x)) ([],[])code snippet (which is also here and probably was known much earlier, too). to extend it to 3- or n-tuples... swapping is rotating, and the only thing left to decide is, in which direction? :)