Next: , Previous: SRFI-14 Predicates/Comparison, Up: SRFI-14


39.12.4 Iterating Over Character Sets

Character set cursors are a means for iterating over the members of a character sets. After creating a character set cursor with char-set-cursor, a cursor can be dereferenced with char-set-ref, advanced to the next member with char-set-cursor-next. Whether a cursor has passed past the last element of the set can be checked with end-of-char-set?.

Additionally, mapping and (un-)folding procedures for character sets are provided.

— Scheme Procedure: char-set-cursor cs

Return a cursor into the character set cs.

— Scheme Procedure: char-set-ref cs cursor

Return the character at the current cursor position cursor in the character set cs. It is an error to pass a cursor for which end-of-char-set? returns true.

— Scheme Procedure: char-set-cursor-next cs cursor

Advance the character set cursor cursor to the next character in the character set cs. It is an error if the cursor given satisfies end-of-char-set?.

— Scheme Procedure: end-of-char-set? cursor

Return #t if cursor has reached the end of a character set, #f otherwise.

— Scheme Procedure: char-set-fold kons knil cs

Fold the procedure kons over the character set cs, initializing it with knil.

— Scheme Procedure: char-set-unfold p f g seed [base]

Return a new character set constructed as specified by procedures p, f, and g, given an initial value seed. More precisely:

— Scheme Procedure: char-set-for-each proc cs

Apply proc to every character in the character set cs.

— Scheme Procedure: char-set-map proc cs

Map the procedure proc over every character in cs. proc must be a character -> character procedure.