-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array->rotate #146
Comments
Would |
+1 for transpose acting on a 2d array. I don't think it makes much sense to have a built in function like this that acts on a 1d array. |
I also say +1 for transpose acting on a 2d array. As for 1 dimensional, I think it may be more time than it is worth, but otherwise am not apposed. needs a new name though @rows->transpose_text |
I agree that transpose is better than rotate, simply because I think of rotation as just that: put the elements on a wheel and spin $x degrees. When I think of transposition on an array, I definitely think of it in the mathematical sense, requiring at least a 2D matrix. Therefore, calling the operation you've described above "transpose" just doesn't quite seem right. However, @exodist's suggestion of transpose_text seems to strike the right balance - The semantics that it is special because the contents are text is much more clear. tl;dr: +1 for transpose_text on a 1d array of text. +1 for transpose on 2d arrays of anything. |
Hmmm, is there a practical use case for this? |
Thinking of an array of strings as rows and columns, flip the columns and rows. So:
Short rows are filled in with spaces, possible configurable option.
See http://stackoverflow.com/questions/3206720/perl-hash-of-hash-and-columns/3206871#3206871 for inspiration.
The text was updated successfully, but these errors were encountered: