All pastes #880225 Raw Edit

Someone

public text v1 · immutable
#880225 ·published 2008-01-29 19:35 UTC
rendered paste body
: iter-rec
  {* the base value:
     normally the function's input value *}
  ( a

    {* the termination predicate:
       called at each step to find out if we're done *}
    ( a -- BOOL )

    {* the termination value:
       the value used as 'the next value' (see later) when the termination
       predicate returns true. *}
    ( -- a )

    {* the stepping function:
       applied to the previous value at each step, to give the value to pass
       in to the loop, giving the next step *}
    ( a -- a )

    {* the combining function:
       given the previous step and the next step, return the value to use *}
    ( a a -- a )

  {* and we give back a value of the same type *}
  -- a )
    ...
;