Wed Jul 23 01:47:44 EDT 2014
Trying out some abstract iterator macros. Basic idea is to create a
begin .. end construct which pushes a value to the stack, or pops one
in the case of a consumer. Though state machines / generators /
sequences (inverted loops) might be a lot easer to work with as I'm
already using those a lot, but they require a variable.
dup st-mark? if drop ; then
dup px st-@
: st[ st-first @ begin dup st-mark? if drop exit then dup ;
: ]st st-@ again ;
: st-print st[ px ]st
There's another problem here that's been playing up a lot in generic
algorithms: there is no skip jump around any of the loop constructs to
handle the 0 iteration case.
This is one of those crazy chuck ideas that go a bit too far in
premature optimization. It is efficient as it avoids an operation
that isn't necessary for many applications.