CHAR-GENERAL-CATEGORY(3scm)

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

πŸŽ€ 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, uppercase
  • Ll β€” Letter, lowercase
  • Lt β€” Letter, titlecase
  • Lm β€” Letter, modifier
  • Lo β€” Letter, other
  • Mn β€” Mark, nonspacing
  • Mc β€” Mark, spacing combining
  • Me β€” Mark, enclosing
  • Nd β€” Number, decimal digit
  • Nl β€” Number, letter
  • No β€” Number, other
  • Pc β€” Punctuation, connector
  • Pd β€” Punctuation, dash
  • Ps β€” Punctuation, open
  • Pe β€” Punctuation, close
  • Pi β€” Punctuation, initial quote
  • Pf β€” Punctuation, final
  • Po β€” Punctuation, other
  • Sm β€” Symbol, math
  • Sc β€” Symbol, currency
  • Sk β€” Symbol, modifier
  • So β€” Symbol, other
  • Zs β€” Separator, space
  • Zl β€” Separator, line
  • Zp β€” Separator, paragraph
  • Cc β€” Other, control
  • Cf β€” Other, format
  • Cs β€” Other, surrogate
  • Co β€” Other, private use
  • Cn β€” 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