Skip to content

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