Looks nice. Have you tried writing your combinators using while?
: (each) ( cursor -- cursor ) [ end? ] [ eval$ next ] [ ] while ; : (map) ( cursor -- cursor ) [ end? ] [ eval! next ] [ ] while ; : (subset) ( cursor -- cursor ) [ end? ] [ eval^ next ] [ ] while ; : (position) ( cursor -- cursor ) [ end-or-eval? ] [ next ] [ ] while ; Also is there a reason you prefer i>> 1+ >>i to [ 1+ ] change-i ? The latter is even a bit longer in this case but it's clearer to me because its instantly recognizable. Slava On Mar 30, 2008, at 2:42 PM, Eduardo Cavazos wrote: > 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 ------------------------------------------------------------------------- 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
