Next: , Previous: , Up: srfi char-sets spec   [Index]


2.9.3.5 Querying character sets

Function: char-set-size cs

Return the number of elements in character set cs.

Function: char-set-count pred cs

Apply pred to the chars of character set cs, and return the number of chars that caused the predicate to return true.

Function: char-set->list cs

Return a list of the members of character set cs. The order in which the characters appear in the list is not defined, and may be different from one call to another.

Function: char-set->string cs

Return a string containing the members of character set cs. The order in which the characters appear in the string is not defined, and may be different from one call to another.

Function: char-set-contains? cs char

Test char for membership in character set cs. Return a boolean.

Function: char-set-every pred cs
Function: char-set-any pred cs

char-set-every procedure returns true if predicate pred returns true of every character in the cs.

char-set-any applies pred to every character in cs, and returns the first true value it finds; if no character produces a true value, it returns #f.

The order in which these procedures sequence through the elements of cs is not specified.

Note that if we need to determine the actual character on which a predicate returns true: we use char-set-any and arrange for the predicate to return the character parameter as its true value:

(char-set-any (lambda (c)
                (and (char-upper-case? c) c))
              cs)