I would like to have a method to transpose a list of lists without using a for loop. That is, some function (call it "Listtranspose" for instance) that flips the "rows" and "columns" of a list of lists, like this:
listlist = {{"cat", "dog", "mouse"}, {"meow", "bark", "squeak"}};
tranlist = Listtranspose(listlist);
Show(tranlist);
/*Result:
{{"cat", "meow"}, {"dog", "bark"}, {"mouse", "squeak}}
An alternate implementation could be something like:
listlist = {{"cat", "dog", "mouse"}, {"meow", "bark", "squeak"}};
nr = NItems(listlist);
col1 = listlist[1::nr][1];
col2 = listlist[1::nr][2];
col3 = listlist[1::nr][3];
translist = EvalList({col1, col2, col3});
I kind of like the latter implementation better as I might only need to transpose just a subset of "columns", not the entire list.
Of course, this can be done using a For Loop, but the reason for asking for this is that For Loops can be slow. I work with large blocks of text and I believe this would help speed things up greatly for me.
Credit to @vince_faller for asking this originally. Transpose List of Lists without a for loop