Boost logo

Boost :

Subject: Re: [boost] compile-time for-loop
From: Gpderetta (gpderetta_at_[hidden])
Date: 2009-09-02 19:16:54


Il giorno 02/set/2009, alle ore 23.17, "klaus triendl"
<klaus_at_triendl.eu> ha scritto:
>
> The for-loop I imagine has two important characteristics:
> 1) resembles a runtime for-loop
> 2) loop expressions are separate from the state to calculate
>
> pseudo runtime code to illustrate what I mean:
> type state;
> for(type loopvalue = start;
> looptest(loopvalue);
> loopvalue = binarynext(state, loopvalue))
> {
> state = binaryop(state, loopvalue);
> }
>
>

This construct is well known among functional programmers and is
called unfold as is the dual of fold

-- 
Gpd

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