Re: crossing lists

2005-10-28 Thread Michele Dondi
On Thu, 27 Oct 2005, Darren Duncan wrote: Not sure if this matter was resolved on a previous discussion, but here goes Definitely is has been discussed at least once, that I know, for I asked this myself, but from a somewhat more mathematical pov. You can find a copy of my mail here: http:

Re: crossing lists

2005-10-28 Thread Luke Palmer
On 10/28/05, Darren Duncan <[EMAIL PROTECTED]> wrote: > One thing I would like to be able to do is this: > >@baz = cross([1,2],[3,4]); # yields ([1,3],[1,4],[2,3],[2,4]) > > And alternately, this: > >for cross([1,2],[3,4]) -> $foo,$bar { ... } # loop has 4 iterations I already proposed thi

Re: crossing lists

2005-10-27 Thread Craig DeForest
If PDL-like threading syntax is adopted, this is trivial. In PDL: $a = pdl(1,2); $b = pdl(3,4); $c = $a->(*1) * $b; print $c; yields the output: [ [3 4] [6 8] ] The '(*1)' inserts a dummy dimension into $a, making it a 1x2-array rather than a 2-array. Then th