Re: Reordering Arrays.

2003-08-14 Thread Sam Vilain
On Wed, 13 Aug 2003, Nicholas Clark wrote: I'm not convinced that it's a great idea to sit it in a top level namespace. Is it about cartography? Or data manipulation? List::Maptastic? One function is for mapping hashes. So it would have to be Collection::Maptastic, or

Re: Reordering Arrays.

2003-08-14 Thread Adam Spiers
Shevek ([EMAIL PROTECTED]) wrote: On Mon, 11 Aug 2003, Mark Fowler wrote: I have this: [ [ 1, 2, 3, ], [ 5, 6, 7, ], ] And I want this: [ [ 1, 5, ], [ 2, 6, ], [ 3, 7, ], ] Don't like the number 4 ?-) How do I do that? Use APL. Or Ruby 1.8:

Re: Reordering Arrays.

2003-08-14 Thread Robin Berjon
Mark Fowler wrote: But does anyone know a module that can do this? Any super fast cleverness that I don't want to even think about? Matrix rotation? Cf. PDL. -- Robin Berjon [EMAIL PROTECTED] Research Engineer, Expwayhttp://expway.fr/ 7FC0 6F5F D864 EFB8 08CE 8E74 58E6 D5DB 4889 2488

Re: Reordering Arrays.

2003-08-14 Thread Dan Brook
If you nab mapcar[0] this is insanely simple use mapcar; use Data::Dumper; my $arrays= [ [1..3], [5..7] ]; my @reordered = mapcar { [EMAIL PROTECTED] } @$arrays; print Dumper([EMAIL PROTECTED]); __output__ $VAR1 = [ [ 1, 5 ], [

Re: Reordering Arrays.

2003-08-14 Thread Mark Fowler
On Wed, 13 Aug 2003, Nicholas Clark wrote: I'm not convinced that it's a great idea to sit it in a top level namespace. Is it about cartography? Or data manipulation? List::Maptastic? -- #!/usr/bin/perl -T use strict; use warnings; print q{Mark Fowler, [EMAIL PROTECTED],

Re: Reordering Arrays.

2003-08-14 Thread Sam Vilain
If you nab mapcar[0] this is insanely simple Shortly to be released to CPAN as Maptastic, as soon as I figure out the iteration semantics. Pre-release available at http://vilain.net/pm/Maptastic-0.99.tar.gz, which has mapcar and mapcaru in it. Feedback most welcome. [0]

Reordering Arrays.

2003-08-14 Thread Mark Fowler
I have this: [ [ 1, 2, 3, ], [ 5, 6, 7, ], ] And I want this: [ [ 1, 5, ], [ 2, 6, ], [ 3, 7, ], ] How do I do that? I mean, I can write this code: sub reorder { my $new = []; foreach my $col_no (0..(@{ $_[0]-[0] } - 1)) { my $new_row = []; foreach my $row

Re: Reordering Arrays.

2003-08-14 Thread Nicholas Clark
On Wed, Aug 13, 2003 at 06:02:59PM +0100, Sam Vilain wrote: If you nab mapcar[0] this is insanely simple Shortly to be released to CPAN as Maptastic, as soon as I figure out the iteration semantics. Pre-release available at http://vilain.net/pm/Maptastic-0.99.tar.gz, which has

Re: Reordering Arrays.

2003-08-14 Thread Chris Devers
On Wed, 13 Aug 2003, Mark Fowler wrote: On Wed, 13 Aug 2003, Nicholas Clark wrote: I'm not convinced that it's a great idea to sit it in a top level namespace. Is it about cartography? Or data manipulation? List::Maptastic? The function in question does matrix rotation -- that's

Re: Reordering Arrays.

2003-08-14 Thread Dan Brook
On Wed, 13 Aug 2003 11:23:41 +0100 (BST) Mark Fowler [EMAIL PROTECTED] wrote: On Tue, 12 Aug 2003, Dan Brook wrote: If you nab mapcar[0] this is insanely simple Interesting. Is there something like this on the CPAN? It's a bit hard to put a page from perlmonks into a PREREQ_PM There's

Re: Reordering Arrays.

2003-08-14 Thread Mark Fowler
On Tue, 12 Aug 2003, Dan Brook wrote: If you nab mapcar[0] this is insanely simple Interesting. Is there something like this on the CPAN? It's a bit hard to put a page from perlmonks into a PREREQ_PM Mark. -- #!/usr/bin/perl -T use strict; use warnings; print q{Mark Fowler, [EMAIL

Re: Reordering Arrays.

2003-08-14 Thread Shevek
On Mon, 11 Aug 2003, Mark Fowler wrote: I have this: [ [ 1, 2, 3, ], [ 5, 6, 7, ], ] And I want this: [ [ 1, 5, ], [ 2, 6, ], [ 3, 7, ], ] How do I do that? I mean, I can write this code: Use APL. Alternatively, something like: map { my $a = $_; map {