digit-value(3scm)
โจ digit-value โ Scheme Programmerโs Manual cutie ๐
okay so bestie, this is the digit-value page from the Scheme Programmerโs Manual, manual name 3scm โ sheโs tiny but she knows exactly one job. ๐
๐ NAME
digit-value โ get the numeric value of a character. literally the whole gig, no cap. โจ
๐ LIBRARY
R7RS girlies import it like this:
(import (scheme char)) ;R7RS
๐ง SYNOPSIS
(digit-value char)
๐ธ DESCRIPTION
This procedure returns the numeric value of its argument if it is a numeric digit or #f on any other character. Numeric digits are those for which char-numeric? returns #t. Only the numeric values 0 to 9 are supported; characters representing other values are non-numeric. So likeโฆ digit? value. not digit? #f. simple as that, periodt. ๐
๐ฆ RETURN VALUES
Returns a single value; an exact integer or #f. one value only, bestie โ exact integer or #f, no extras. ๐ซถ
๐ฅ EXAMPLES
vibe check, look:
(digit-value #\3) => 3
(digit-value #\x0664) => 4 ;if supported
(digit-value #\x0AE6) => 0 ;if supported
(digit-value #\x0EA6) => #f ;if supported
๐ COMPATIBILITY
Implementations are not required to support characters other than ASCII (excluding #\null). Therefore only the characters #\0 to #\9 need to be supported. Even implementations with full Unicode support may return #f for some characters that other implementations support, because the Unicode standard changes over time.
๐ซถ so true bestie: donโt assume every Unicode character is gonna hit the same in every implementation. the standard be moving.
๐ ERRORS
It is an error if the wrong number of arguments was passed or an argument was outside its domain. Implementations may signal an error, extend the procedureโs domain of definition to include such arguments, or fail catastrophically.
โ ๏ธ โfail catastrophicallyโ is literally right there in the manual. not me being dramatic. ๐
๐ SEE ALSO
string->number(3scm)char-general-category(3scm)char-numeric?(3scm)
๐ STANDARDS
R7RS. iconic. โจ
๐ฐ๏ธ HISTORY
This procedure first appeared in R7RS. yes sheโs an R7RS baby. ๐
๐ 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/.
mwah ๐ โ this is digit-value(3scm) from the Scheme Programmerโs Manual, dated 2023-03-21, part of the scheme-manpages project. byeee, go get those numeric digits ๐ซถโจ
๐ฆ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- ๐ the page's license: MIT
- Copyright (c) 2023 Gwen Weinholt
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms