Re: Aggregation (with GBY) is Relational Division
From: Frank Hamersley <terabitemightbe_at_bigpond.com>
Date: Wed, 07 Jun 2006 04:44:31 GMT
Message-ID: <PQshg.4775$ap3.560_at_news-server.bigpond.net.au>
> No, foldl (+) 4 [1..3] => ((4+1)+2)+3 = 10
>
> foldr (+) 4 [1..3] => 1 + (2 + (3 +4)) = 10
Date: Wed, 07 Jun 2006 04:44:31 GMT
Message-ID: <PQshg.4775$ap3.560_at_news-server.bigpond.net.au>
vc wrote:
> Frank Hamersley wrote:
[..]
>> I know its just an intro web page ... but does anyone know how foldr >> disperses the start point? >> >> eg> fold1 (+) 4 [1..3] produces a computational sequence 4+1+2+3 >>
> No, foldl (+) 4 [1..3] => ((4+1)+2)+3 = 10
Per your subsequent post - our expressions are the "same".
>> so does >> >> eg> foldr (+) 4 [1..3] produce 4+3+2+1 or 3+2+1+4?
>
> foldr (+) 4 [1..3] => 1 + (2 + (3 +4)) = 10
or
foldr (+) 4 [1..3] => 1 + (2 + (4 + 3)) = 10
or
foldr (+) 4 [1..3] => (((4 + 3) + 2) + 1) = 10
???
The question becomes does the leftness/rightness persist in the
construction of the expression prior to evaluation. I must confess my
past exposure to stack oriented processing of expressions is influencing
my interest.
Cheers, Frank.