Any update on a transpose function?

Any news about adding a transpose function to the standard lib? It was discussed on the mailing list in 2021, but nothing since.

Transposing lists are a quite common operation and people often talk about it online like on this forum. From working with CSV, to doing the advent of code, transposing matrix is everywhere.

  • The impact on the eco-system would be limited. This is just another function.
  • The impact on learning would be good since this function is quite common in other language. Even VBA has it.
  • This suggestion is easily implemented with the state of Elixir
  • Some people wont need it but others will be grateful to find it.

cheers,

1 Like

There is a transpose function in Explorer which I think is a better fit than the standard library. Lists of lists are just flat not an efficient structure on which to do matrix operations, and I don’t think it makes sense to build a set of functions around using them for that purpose.

5 Likes

So we need an external dependence to do something as trivial as rotate a list of list? I am not asking to handle matrix in the standard library, I am asking for something for List and Enum.

1 Like

Serious question: when are you rotating a list of lists in Elixir? Advent of code and other puzzles don’t count.

Explorer and Nx were created by the creators of elixir explicitly to do number crunching operations in the language. Given the extra dependencies involved and the relatively specialized area of work for those operations within the general use cases of the language.

2 Likes

Isn‘t Enum.zip_with(nested, & &1) what you‘re looking for?

3 Likes

Yes it is working. Note that what I am looking for is not quite an implementation of transpose but a way to add transpose to the library. This goal is not have to write it each time

transpose = fn nested -> Enum.zip_with(nested, & &1) end
1 Like

Last time it was to handle data send by a client in day job. It was not in Elixir. So the answer to " Any update on a transpose function?" would be “none because not enough people ask for it” right?

1 Like

I don’t speak for Ben but IMO the answer would be more along the lines of: “We deem this a more specialized functionality and as such we will not put it in the standard library and into a dedicated number-crunching library instead”.

2 Likes

alright. thank you

1 Like