Boost logo

Boost :

Subject: Re: [boost] [fusion] Any chance we can incorporate more folds?
From: David Sankel (camior_at_[hidden])
Date: 2010-08-20 20:14:30


On Fri, Aug 20, 2010 at 7:59 PM, Joel de Guzman
<joel_at_[hidden]>wrote:

> On 8/21/2010 5:21 AM, Steven Watanabe wrote:
>
>> AMDG
>>
>> David Sankel wrote:
>>
>>> I've implemented, in particular, foldr1:
>>>
>>> template<
>>> typename Sequence,
>>> typename State,
>>> typename F
>>> typename result_of::foldr1<Sequence, F>::type foldr1(
>>> Sequence& seq, F const& f);
>>>
>>> Semantics:
>>>
>>> Equivalent to f(....f(f(e1,e2),e3)...) where e1 ...eN are the elements
>>> of seq.
>>>
>>> It is very useful for fusion sequences of possibly distinct types that
>>> have
>>> identical concepts which can be merged in some way (like generators).
>>>
>>> I very much like the folds that are included in Haskell's prelude, namely
>>> foldl, foldl1, foldr (somewhat like boost's fold), and foldr1[1].
>>>
>>
>> We already have reverse_fold, which makes 2/4.
>>
>
> These contributions are very welcome, David. I'd love to take them in
> if you also plan to write some docs to go with it :-)
>

Sure thing. Thanks.

-- 
David Sankel
Sankel Software
www.sankelsoftware.com
585 617 4748 (Office)

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk