boris_m

10 Reputation

One Badge

11 years, 144 days

MaplePrimes Activity


These are questions asked by boris_m

I wrote the following code inside a code region in order to implement a scalar product for lists:

m:= module() option package; export `*`;
    `*`:= proc( a::list, b::list) option overload;
        return add(i, i  in zip((x, y)-> x*y, a, b));
    end proc;    
end module;
l1:=[1,2,3,4];
l2:=[4,1,0,5];
with(m);
l1*l2;

when i run the code I sometimes get the desired result ->26

but sometimes I get

I don't have any clue, where this weird behaviour comes from.

Any help would be greatly appreciated.

 

Page 1 of 1