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

wants to merge 7 commits into


None yet
2 participants

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 some commits Jun 20, 2009

@schwern schwern Add IO::All but chop out the guessing about what it is. Only work with
files and leave everything else to be explicit.

Also add io->url() for opening URLs.
@schwern schwern Merge branch 'master' into io-all
ben hengst building out the array transpose method as requested in #146 50526bd

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 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 commented Jun 10, 2013


ben hengst added some commits Jun 14, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment