Re: string-cursor? predicate
John Cowan 21 Apr 2016 20:37 UTC
Takashi Kato scripsit:
> I've just noticed there is no string-cursor? predicate. Since the SRFI
> adds cursor type, I think it's better to have a predicate for it. Or
> is there a reason why it's not there?
Cursors don't necessarily belong to a disjoint type. In Chibi they do,
but they could also be implemented as negative exact integers or by some
other means.
I thought of having a predicate (valid-string-cursor? s c) that returns
#t iff c is a valid cursor for s, but it might need to be O(n) in the
length of s, which is not what you expect from a type predicate.
--
John Cowan http://www.ccil.org/~cowan xxxxxx@ccil.org
I am a member of a civilization. --David Brin