Re: Looping in perl

2000-08-31 Thread Karl Glazebrook
Jeremy Howard wrote: > @b = (1,2,3); > @c = (2,4,6); > @d = (-2,-4,-6); > $sum = reduce ^_+^_, @b * @c + @d; > > should be evaluated as if it read: > > $sum = 0; > $sum += $b[$_] * $c[$_] + $d[_] for (0..$#a-1)); > > That is, no temporary list is created, and only one loop is requi

Re: Looping in perl

2000-08-31 Thread Jeremy Howard
Baris wrote: > Looping through the matrix elements is probably most common thing people do > in matrix computation. And because of some weird reason I am not aware of, > the only way to do this efficiently is to write your program in C. So > everybody I know sooner or later switches to C because o

Re: Looping in perl

2000-08-31 Thread Christian Soeller
Baris wrote: > PDL has PP, which is very nice, but you still need to compile the code (Is > this correct? Is there any documentation about how to compile pp code?). There is. It's towards the end of the PP manpage. > sub sumit{ >my @a = @_; > $tmp = 0; >