6.6.4.3 Creating Character Sets

New character sets are produced with these procedures.

Scheme Procedure: char-set-copy cs
C Function: scm_char_set_copy (cs)

Return a newly allocated character set containing all characters in cs.

Scheme Procedure: char-set chr …
C Function: scm_char_set (chrs)

Return a character set containing all given characters.

Scheme Procedure: list->char-set list [base_cs]
C Function: scm_list_to_char_set (list, base_cs)

Convert the character list list to a character set. If the character set base_cs is given, the character in this set are also included in the result.

Scheme Procedure: list->char-set! list base_cs
C Function: scm_list_to_char_set_x (list, base_cs)

Convert the character list list to a character set. The characters are added to base_cs and base_cs is returned.

Scheme Procedure: string->char-set str [base_cs]
C Function: scm_string_to_char_set (str, base_cs)

Convert the string str to a character set. If the character set base_cs is given, the characters in this set are also included in the result.

Scheme Procedure: string->char-set! str base_cs
C Function: scm_string_to_char_set_x (str, base_cs)

Convert the string str to a character set. The characters from the string are added to base_cs, and base_cs is returned.

Scheme Procedure: char-set-filter pred cs [base_cs]
C Function: scm_char_set_filter (pred, cs, base_cs)

Return a character set containing every character from cs so that it satisfies pred. If provided, the characters from base_cs are added to the result.

Scheme Procedure: char-set-filter! pred cs base_cs
C Function: scm_char_set_filter_x (pred, cs, base_cs)

Return a character set containing every character from cs so that it satisfies pred. The characters are added to base_cs and base_cs is returned.

Scheme Procedure: ucs-range->char-set lower upper [error [base_cs]]
C Function: scm_ucs_range_to_char_set (lower, upper, error, base_cs)

Return a character set containing all characters whose character codes lie in the half-open range [lower,upper).

If error is a true value, an error is signaled if the specified range contains characters which are not contained in the implemented character range. If error is #f, these characters are silently left out of the resulting character set.

The characters in base_cs are added to the result, if given.

Scheme Procedure: ucs-range->char-set! lower upper error base_cs
C Function: scm_ucs_range_to_char_set_x (lower, upper, error, base_cs)

Return a character set containing all characters whose character codes lie in the half-open range [lower,upper).

If error is a true value, an error is signaled if the specified range contains characters which are not contained in the implemented character range. If error is #f, these characters are silently left out of the resulting character set.

The characters are added to base_cs and base_cs is returned.

Scheme Procedure: ->char-set x
C Function: scm_to_char_set (x)

Coerces x into a char-set. x may be a string, character or char-set. A string is converted to the set of its constituent characters; a character is converted to a singleton set; a char-set is returned as-is.