[Haskell-cafe] 'Associative' order of calling

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Sat Oct 24 22:55:18 UTC 2015


On Sat, Oct 24, 2015 at 08:12:11PM +0200, Janis Voigtländer wrote:
> It has already been established in this thread what Charles meant by 3.
> 
> He meant that a fold-function that has the property he is after would
> guarantee that it:
> 
> a) takes all the content elements from a data structure, say x1,...,xn,
> 
> b) builds an application tree with the to-be-folded, binary operation f in
> the internal nodes of a binary tree, whose leafs, read from left to right,
> form exactly the sequence x1,...,xn,
> 
> c) evaluates that application tree.
> 
> Do you agree that what I describe above is a property of a given fold-like
> function, not of the f handed to that fold-like function?
> 
> And do you agree that what I describe above is a property that is weaker
> than (and so, in particular different from) for example the property "this
> fold-like function is foldl or foldr".

I do agree.  I would be interested whether you think such a property could
differ from my earlier proposed property:

    "the function factors through `foldl f`", i.e.  is `g . foldl f` for
    some `g`.

(Actually when I wrote that I suppose I meant `g . foldl f z` for some `g`
and `z`)

Tom


More information about the Haskell-Cafe mailing list