Various (and almost completely unrelated) questions and opini ons

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Various (and almost completely unrelated) questions and opini ons

James Hague-3
Chris Pressey wrote

>
> Well, actually, for me, the pain is having those parentheses
> - a nesting
> level.  I work with rather long numerical expressions.  And
> 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 :)

James


Reply | Threaded
Open this post in threaded view
|

Various (and almost completely unrelated) questions and opini ons

Ulf Wiger-4
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