argument ordering (was: Re: Priority Queues, or lack thereof)

Malcolm Wallace Malcolm.Wallace at
Fri Aug 19 10:43:16 EDT 2005

> This style supports multiple operations nicely, especially with combined
> with the $ operator.

But note that the version with $ is actually longer than the one
with nested parens!  And where the operands are not statically known,
the different orderings do simply come down to foldl/foldr preference:

>     insert 1 $ insert 2 $ insert 3 $ someSet
  ==  foldr insert someSet [1,2,3]

>     insert (insert (insert someSet 3) 2) 1
  ==  foldl insert someSet [3,2,1]

In some sense the foldl variant is more 'obvious' about the order in
which elements are actually inserted.


More information about the Libraries mailing list