Re: [isabelle] argument order of List.foldr

On Sat, Mar 6, 2010 at 10:36 AM, Lucas Dixon <ldixon at> wrote:
> I really like Isabelle's argument-order for fold; in particular I
> frequently fold over list in order to update some value:
> a |> fold f l
>  |> fold f2 l2
> This argument order is also nice for combine folds...
> fold o fold : ('a -> 'b -> 'b) -> 'a list list -> 'b -> 'b

On Sat, Mar 6, 2010 at 12:28 PM, Alexander Krauss <krauss at> wrote:
> it is not so much folding a binary operation like "+" but more an iteration
> of a transformation of a state. But it is the only version that composes
> (fold o fold).

These are good points. I guess both argument orders have their uses,
in different situations. I suppose I was thinking with a Haskell bias,
since partially-applied foldr is used a lot in Haskell. Also, the
"fold o fold" situation never seems to come up in Haskell either,
since for state transformers people generally use mapM with a state
monad rather than a fold.

- Brian

This archive was generated by a fusion of Pipermail (Mailman edition) and MHonArc.