CHAR-GENERAL-CATEGORY(3scm)
π char-general-category(3scm) β Scheme Programmer's Manual π
okay bestie, welcome to the char-gen...-category(3scm) page from the Scheme Programmer's Manual π
β¨. This is the little Scheme procedure that does a whole vibe check on a character and tells you its Unicode general category. no cap, it's giving "small function, big Unicode energy."
πΈ NAME πΈ
char-general-category β Unicode character category π¦
π LIBRARY π
(import (rnrs)) ;R6RS
(import (rnrs unicode)) ;R6RS
β¨ SYNOPSIS β¨
(char-general-category char)
π DESCRIPTION π
okay so this procedure returns a symbol representing the Unicode general category of char. That's the whole vibe: you hand it a character, it hands you back the category symbol. periodt. π
The category is one of the following symbols β all of them, bestie, we're not skipping a single one π:
Luβ Letter, uppercaseLlβ Letter, lowercaseLtβ Letter, titlecaseLmβ Letter, modifierLoβ Letter, otherMnβ Mark, nonspacingMcβ Mark, spacing combiningMeβ Mark, enclosingNdβ Number, decimal digitNlβ Number, letterNoβ Number, otherPcβ Punctuation, connectorPdβ Punctuation, dashPsβ Punctuation, openPeβ Punctuation, closePiβ Punctuation, initial quotePfβ Punctuation, finalPoβ Punctuation, otherSmβ Symbol, mathScβ Symbol, currencySkβ Symbol, modifierSoβ Symbol, otherZsβ Separator, spaceZlβ Separator, lineZpβ Separator, paragraphCcβ Other, controlCfβ Other, formatCsβ Other, surrogateCoβ Other, private useCnβ Other, not assigned
π«Ά RETURN VALUES π«Ά
Returns a single symbol. that's it. one symbol. iconic. π―
π EXAMPLES π
look at these cuties:
(char-general-category #\a)
=> Ll
(char-general-category #\space)
=> Zs
(char-general-category #\x10FFFF)
=> Cn
Ll for the lowercase a, Zs for space, and Cn for #\x10FFFF β the examples ate, fr fr. π₯
π₯ APPLICATION USAGE π₯
This procedure commonly appears in Scheme readers. Both R6RS and R7RS define the lexical syntax in terms of Unicode general categories. Another use is in algorithms for rendering text. β¨
That's literally main-character energy in a reader, iykyk.
π COMPATIBILITY π
This procedure is only present in R6RS (but any implementation that supports Unicode will necessarily have access to the data). The exact values returned will depend on which version of the Unicode database was used to generate the lookup tables. ngl, that's the fine print, bestie. π
π¨ 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.
not the vibe, but good to know π«Ά.
π SEE ALSO π
char-alphabetic?(3scm)
go give your other Unicode bestie a look π .
β STANDARDS β
R6RS
π 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/.
made with π from the char-gen...-category(3scm) besties, dated 2021-02-21 β bye bestie, go slay some Unicode π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2021 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms