Re: predicate->char-set considered harmful
shivers@xxxxxx 19 Dec 2000 02:45 UTC
I'm trying to think of a way to embed an escape procedure into
predicate->char-set[!]. Is the following legal? Does it solve
the "I only want to examine ASCII characters to build this set"
problem?
(define cs
(let ((result (char-set)))
(call-with-current-continuation
(lambda (exit)
(predicate->char-set! (lambda (ch) (or (char=? ch #\newline)
(and (> (char->integer ch) 127)
(exit))))
result)))
result))
I suppose one would need a guarantee that characters are examined in
(char->integer ch) order, and it would have to add the character to
result immediately when the predicate returned true, and it isn't
linear update, and ...
Yep, the spec doesn't give you any of these guarantees.
Don't fight the system. Be one with the system.
-Olin