Various (and almost completely unrelated) questions and opini ons

Ulf Wiger etxuwig@REDACTED
Wed Feb 21 23:43:07 CET 2001


On Wed, 21 Feb 2001, James Hague wrote:

>Chris Pressey wrote
>> to me it is much easier to read
>> 
>>   a * b * c * d * e * f * g.
>> 
>> than
>> 
>>   matmul(a, matmul(b, matmul(c, matmul(d, matmul(e, matmul(f, g)))))).
>
>Of course in Lisp you'd just say:
>
>(matmul a b c d e f g)
>
>which is even shorter than the infix version :)

Ok, so

matmul([V|Values]) ->
   lists:foldl(fun(X,Prod) -> matmul(Prod, X) end, V, Values).

...
   matmul([a,b,c,d,e,f,g]).

(:

/Uffe
-- 
Ulf Wiger                                    tfn: +46  8 719 81 95
Senior System Architect                      mob: +46 70 519 81 95
Strategic Product & System Management    ATM Multiservice Networks
Data Backbone & Optical Services Division      Ericsson Telecom AB




More information about the erlang-questions mailing list