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

Re: [FWP] Cartesian Cross-Products



  Hello again,

  I couldn't help but shrink it to :

sub cartesian {
  my @res = [] ; 
  @res = map {$a=$_;map {[$a,@$_]} @res} @$_ for reverse @_ ;
  @res ;
}


  The lists are unrolled last to first, which seems more natural.

  Cheers,

  Etienne

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