Re: Aggregation (with GBY) is Relational Division

From: Frank Hamersley <>
Date: Tue, 06 Jun 2006 06:10:47 GMT
Message-ID: <H%8hg.4157$>

David Cressey wrote:

> "Marshall" <> wrote in message

>> David Cressey wrote:
>>> "Marshall" <> wrote in message
>>> PS: can you point me to a web site that will explain "fold" to me?
>> I did a bit of searching and came up with a short intro:
>> Fold is simply inserting a binary operator "in between" the elements
>> in a collection. Usually an ordered, collection, alas. Since it's an
>> ordered collection, they have to do the extra work to take order
>> into account, so you have both foldl and foldr, depending on
>> whether you start at the "left" end of the list or the "right".
>> (Beginning vs. end.)
>> foldl(append, [], [1, 2, 3])
>> returns [3, 2, 1]
>> Fold depends on being able to separate the first element of a list
>> from the rest, and on the ability to recognize an empty list, but
>> I don't think it needs anything else.
> Thanks for the info on fold.  I think I'm going to try to learn this one.
> It looks useful.
> So fold needs car, cdr, and nil,  but nothing else.  Hmmmmmmm.......

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

so does

   eg> foldr (+) 4 [1..3] produce 4+3+2+1 or 3+2+1+4?

ie. is the start point element relocated (or not) or would you write it as "foldr (+) [1..3] 4"?

Cheers, Frank. Received on Tue Jun 06 2006 - 08:10:47 CEST

Original text of this message