[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

RE: [FWP] Cartesian Cross-Products



Clever. Etienne, how about submitting it to TPJ as a one-liner?  It's not
strictly one line, but many I've seen published there aren't.

> -----Original Message-----
> From:	Jeff Pinyan [SMTP:jeffp@crusoe.net]
> Sent:	Wednesday, April 12, 2000 5:34 AM
> To:	Etienne Grossmann
> Cc:	fwp@technofile.org
> Subject:	Re:  [FWP] Cartesian Cross-Products
> 
> >sub cartesian {
> >  my @res = [] ; 
> >  @res = map {$a=$_;map {[$a,@$_]} @res} @$_ for reverse @_ ;
> >  @res ;
> >}
> 
> Wow, I understand that completely, and it's damn fast.
> 
> -- 
> MIDN 4/C PINYAN, NROTCURPI, US Naval Reserve             japhy@pobox.com
> http://www.pobox.com/~japhy/                  http://pinyaj.stu.rpi.edu/
> PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
> The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
> 
> 
> ==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
> ==== Send email to <fwp-request@technofile.org> with message _body_
> ====   unsubscribe

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe