# the accumulator generator

## cyfododd — 2003-05-07 17:45:58

    Hello,

    I'm new to this group.  I've skimmed most of the early messages (the

    first 800 or so), as well as a few of the more recent ones.

    Anyway, regarding the accumulator generator: it was suggested earlier

    that the following meets the requirements for foo...

    DEFINE foo == [+ foo] cons.

    ...and here is a primitive example trace:

    newstack; 30 11 5 4 stack;

    foo stack;

    cons i stack; cons i stack; cons i stack;

    14 swons i stack; 36 swons i stack;

    first;

    2 1 foo stack first; cons i first.

    [4 5 11 30]

    [[4 + foo] 5 11 30]

    [[9 + foo] 11 30]

    [[20 + foo] 30]

    [[50 + foo]]

    [[64 + foo]]

    [[100 + foo]]

    100

    [1 + foo]

    3

    This seems correct to me (if it isn't, what am I missing?).

    -hodge