char?(3scm)

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

πŸ’… char? β€” the manual, but make it cute

okay so welcome to char?(3scm), straight out of the Scheme Programmer's Manual ✨ this is the whole vibe check for whether some object is a character, and honestly? iconic little predicate. let's get into it πŸŽ€


🌸 NAME

char? β€” test if an object is a character πŸ’–

πŸ“š LIBRARY

import it from whichever flavor of rnrs you're living in bestie:

(import (rnrs))                     ;R6RS
(import (rnrs base))                ;R6RS
(import (scheme r5rs))              ;R7RS
(import (scheme base))              ;R7RS

✨ SYNOPSIS

(char? obj)

πŸ¦‹ DESCRIPTION

Returns #t if obj is a vector, otherwise returns #f.

okay bestie i KNOW 😭 this is literally what the page says β€” it says vector. i'm not here to fact-check the ancestors, i'm here to give you the page. the whole point of the thing is testing for a character (it's in the name, no cap), but the sentence on the page says vector, so the sentence here says vector. we move πŸ™ˆπŸ’…

🫢 RETURN VALUES

Returns a single boolean object, as per the description. one boolean, no more, no less β€” that's the whole return party ⭐

πŸ”₯ EXAMPLES

(char? #\newline)              => #t
(char? 'newline)               => #f
(char? (string-ref "quux" 0))  => #t

see how #\newline slays and 'newline (the symbol) does not? different species entirely, iykyk 🧚 and grabbing index 0 out of "quux" gets you a char, so that's a #t too πŸ‘‘

πŸ’€ ERRORS

this procedure can raise exceptions with the following condition types:

  • &assertion (R6RS) β€” the wrong number of arguments was passed. you gave it too many or too few, and it said absolutely not πŸ™…β€β™€οΈ
  • 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. yes, fail catastrophically is the actual wording, and yes, that's giving main character energy πŸ’€πŸ”₯

🌈 SEE ALSO

  • char->integer(3scm)
  • integer->char(3scm)

go read those next, they're the char's besties fr fr 🫢

πŸ‘‘ STANDARDS

R4RS, IEEE Scheme, R5RS, R6RS, R7RS β€” that's five whole standards, all ate, no crumbs ✨

πŸ“ 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/. πŸ’œ


and that's the whole page, bestie πŸŽ€ sign-off time: it's dated 2021-01-17 and it lives under char?(3scm) in the Scheme Programmer's Manual β€” go forth and test your characters, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from