[racket] Text% efficiently iterating over items

From: Erich Rast (erich at snafu.de)
Date: Mon Dec 12 17:36:42 EST 2011

Yes, sorry, I've meant string-snip%.

Okay, I'll iterate over snips then, because I need to match
whole character sets. 

Thanks!

Best,

Erich

 On Mon, 12 Dec 2011 16:12:13 -0600
Robby Findler <robby at eecs.northwestern.edu> wrote:

> You might get away with just using the find-string method of text%,
> but if not, then you do have to iterate snip by snip. The positions
> inside string-snip%s are offsets from the position of the whole snip
> for characters (is that what you're asking for when you say
> text-snip%?).
> 
> Robby
> 
> On Mon, Dec 12, 2011 at 4:08 PM, Erich Rast <erich at snafu.de> wrote:
> > Is there a fast way to iterate over items or words in a text%
> > instance starting from some position. For example, I'd like to go
> > forward or backward starting from a position until a character in a
> > given srfi14 char-set is found.
> >
> > Using a string returned get-text doesn't seem to work in general
> > because of the ambiguity between "." meaning dot or being an
> > embedded image.
> >
> > Do I need to iterate over snips using find-snip and then use the
> > same position in the snip if it is a text-snip%? Is the position
> > within a text-snip% the same as the position used by find-snip? If
> > not, how do I calculate the offset?
> >
> >
> > Best,
> >
> > Erich
> >
> > _________________________________________________
> >  For list-related administrative tasks:
> >  http://lists.racket-lang.org/listinfo/users




Posted on the users mailing list.