Hello,
The code assumes a 'push' with effect ( vec obj -- vec ). Also, this subset
doesn't preserve the type of the input sequence. This is trivial to add and I
think there's a better abstraction for this operation anyway. The idea is to
make a kind of subclass of vector which knows what type of sequence
to "revert" to. So instead of keeping the old sequence around only for it's
type, you use a word like this:
: revert ( special-vector -- seq ) ... ;
and it does the right thing.
Subset would look like this given that mechanism:
: subset ( seq quot -- seq ) over <reverter> -rot (subset) revert ;
A benefit of this abstraction is that you eliminate a space on the data or
retain stacks. This is very helpful in the implementation of complex words
which have a big stack footprint.
Ed
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk