Re: Avoid memory copy and redundant loops in reduce/fold

2000-08-04 Thread Jeremy Howard
Ken Fox wrote: > > $a = sum(@b*@c+@d) > > I'm not strong in math, but I do remember a bit about row and column > vectors. Isn't @b*@c ambiguous? Shouldn't it normally be interpreted > as a dot product, i.e. treat all vectors the same? > It depends on what perl6-language comes up with. Probably

Re: Avoid memory copy and redundant loops in reduce/fold

2000-08-04 Thread Chaim Frenkel
> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes: DS> At 06:51 AM 8/4/00 -0700, Benjamin Stuhl wrote: >> This actually leads to a much more general question, namely >> passing of arrays to functions. For ppcode at least and >> probably any code using the perl API, it should be possible >> an

Re: Avoid memory copy and redundant loops in reduce/fold

2000-08-04 Thread Dan Sugalski
At 06:51 AM 8/4/00 -0700, Benjamin Stuhl wrote: >This actually leads to a much more general question, namely >passing of arrays to functions. For ppcode at least and >probably any code using the perl API, it should be possible >and IMHO desirable to push the AV* (or equivalent), rather >than expan

Re: Avoid memory copy and redundant loops in reduce/fold

2000-08-04 Thread Ken Fox
Jeremy Howard wrote: > $a = sum(@b*@c+@d) I'm not strong in math, but I do remember a bit about row and column vectors. Isn't @b*@c ambiguous? Shouldn't it normally be interpreted as a dot product, i.e. treat all vectors the same? > The normal problem with this type of structure is that the prev

Re: Avoid memory copy and redundant loops in reduce/fold

2000-08-04 Thread Benjamin Stuhl
> The normal problem with this type of structure is that > the previous > statement would create 2 array copies, and 3 loops for > most compilers. In > perl speak, it might look like: > $dummy1[$_] = $b[$_]*$c[$_] for (0..$#b-1); > $dummy2[$_] = $d[$_]+$dummy1[$_] for (0..$#dummy1-1); > $sum+=$_ f

Avoid memory copy and redundant loops in reduce/fold

2000-08-04 Thread Jeremy Howard
I'm a bit unsure of where to put this... it's a question of implementation, but of a feature that is still being discussed still in perl6-language... Let me know if this is the wrong forum or the wrong time... There's been a lot of discussion about reduce/fold on perl6-language. The details are s