Hello,
Here's another experiment in cursor implementation:
http://dharmatech.onigirihouse.com/cursor/cursor.factor
Some combinators in terms of that vocab:
http://dharmatech.onigirihouse.com/cursor/combinators/combinators.factor
The basic operations on the cursor are:
beg? end? prev next curr
You can get the "index" with 'i>>'.
There's an "extended" cursor called eval-cursor with a slot for a quotation.
An 'eval' word can be used to evaluate the cursor's quotation on the current
value.
The subset-cursor is an extention of an eval-cursor; it has a slot for the
accumulation vector. It's used to implement... subset.
The symmetry of (each), (map), (subset), and (position) is nice. Well, I sort
of shoehorned (position) in there. :-)
One point here is that with the right cursor abstraction, 'each' and 'map' are
both two-liners.
Ed
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk