char-alphabetic?(3scm)

πŸ“¦ version 0-unstable-2024-02, in nixpkgs unstable

πŸŽ€ char-alphabetic?, char-numeric?, etc β€” test character properties πŸŽ€

bestie, welcome to the char-alphabetic?(3scm) page from the Scheme Programmer's Manual. it is literally all about testing character properties, and we are keeping every single detail because that's the whole vibe. πŸ’…

✨ NAME ✨

char-alphabetic?, char-numeric?, etc. β€” these cuties test character properties. that's the name, that's the game. 🫢

πŸ“š LIBRARY πŸ“š

okay so import these depending on your flavor:

(import (rnrs))                     ;R6RS
(import (rnrs unicode))             ;R6RS
(import (scheme r5rs))              ;R7RS
(import (scheme char))              ;R7RS

🌸 SYNOPSIS 🌸

the procedure shapes are giving exactly this:

(char-alphabetic? char)
(char-numeric? char)
(char-whitespace? char)
(char-upper-case? char)
(char-lower-case? char)
(char-title-case? char)             ;R6RS

πŸ’– DESCRIPTION πŸ’–

okay so these procedures return #t if their arguments are alphabetic, numeric, whitespace, upper-case, lower-case, or title-case characters, respectively; otherwise they return #f. iconic boolean behavior, no cap.

here's the breakdown, bestie:

  • A character is alphabetic if it has the Unicode "Alphabetic" property.
  • A character is numeric if it has the Unicode "Numeric" property.
  • A character is whitespace if it has the Unicode "White_Space" property.
  • A character is upper case if it has the Unicode "Uppercase" property.
  • A character is lower case if it has the "Lowercase" property.
  • A character is title case if it is in the Lt general category.

R7RS notes that char-numeric? tests for "Numeric_Type=Decimal". Either way, it checks if the character is a decimal number. fr fr, decimal-coded.

πŸ¦‹ RETURN VALUES πŸ¦‹

Returns a single boolean value. one value, one destiny. ✨

πŸ“ EXAMPLES πŸ“

(char-alphabetic? #\a)      =>  #t
(char-numeric? #\1)         =>  #t
(char-whitespace? #\space)  =>  #t

;; The following are not required to be supported in R7RS.
(char-numeric? #\x096A)     =>  #t
(char-whitespace? #\x00A0)  =>  #t
(char-upper-case? #\Ξ£)      =>  #t
(char-lower-case? #\Οƒ)      =>  #t

🌈 COMPATIBILITY 🌈

Compatibility in R7RS systems depends on the implementation's supported character set. In systems that support Unicode, these procedures return different results depending on the supported Unicode version.

R5RS and earlier reports mention the proper semantics for ASCII, but implementations are free to use e.g. EBCDIC instead. yes, EBCDIC said hi. 😭

πŸ’€ ERRORS πŸ’€

This procedure can raise exceptions with the following condition types:

  • &assertion (R6RS) β€” the wrong number of arguments was passed or an argument was outside its domain.
  • R7RS β€” the assertions described above are errors. Implementations may signal an error, extend the procedure's domain of definition to include such arguments, or fail catastrophically.

πŸ‘‘ SEE ALSO πŸ‘‘

char->integer(3scm) β€” go see it, bestie. 🫢

⭐ STANDARDS ⭐

R4RS, IEEE Scheme, R5RS, R6RS, R7RS. standards-coded and thriving.

🧚 AUTHORS 🧚

This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/.


okay bestie, that's the page. cute little footer sign-off: 2021-02-20, for char-alphabetic?(3scm). stay boolean and stay slay. πŸ’œ

πŸ“¦ where this page comes from