Skip to content
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

[NEEDS INPUT] building out the array transpose method as requested in #146 #242

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

notbenh
Copy link
Contributor

@notbenh notbenh commented Mar 21, 2013

While I am not exactly sure why one would use this and if it really belongs in core, it was an fun bit of coding. Currently it always outputs a array of strings even if it was handed a 2d array. I am not sure if this is really what we want to happen here. Also if does not check to see if $fill character is a single character or not, should it? It seems that if you are altering the default then you know what you are doing, though again as I can not really conceive why this is useful I am failing to find a case where this would help.

schwern and others added 3 commits June 19, 2009 22:04
@notbenh
Copy link
Contributor Author

notbenh commented Mar 22, 2013

In talking with @schwern this should only take arrays of arrays OR arrays of strings. MIXED TYPES OR ANY OTHER REF => EXCEPTION!

[[1,2,3],[1,2,3]]->transpose; # [[1,1],[2,2],[3,3]]
['AA','BB','CC',]->transpose; # ['ABC','ABC']

Oh and make the option for transpose not positional rather make it take a hashref.

@schwern
Copy link
Contributor

schwern commented Mar 22, 2013

And one more example...

[
    [["F", "O", "O"], "BAR", "BAZ"],
    [1, 2, 3]
    ["A", "B", "C"]
]

transposes to...

[
    [["F", "O", "O"], 1, "A"],
    ["BAR", 2, "B"],
    ["BAZ", 3, "C"]
]

Which is to say, in the 2D array case all the items are treated as atoms.

@schwern
Copy link
Contributor

schwern commented Jun 10, 2013

Ping?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants