in reply to Transposer
You said your motivation was a need to
take a list of tuples and give back the list of all the nth elements of each tuplebut the code you posted doesn't do exactly that. (It transposes a matrix, as already discussed.) So here's code that does exactly that.
Trivial, as you can see.# first arg: n # second arg: array(ref) of arrays. # return: list of nth elements. sub nth_elem { map $_->[$_[0]], @{$_[1]} }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Transposer
by Pied (Monk) on Jul 14, 2005 at 06:29 UTC | |
by jdporter (Paladin) on Jul 14, 2005 at 14:31 UTC |
In Section
Code Catacombs