digit-value(3scm)

๐Ÿ“ฆ version 0-unstable-2024-02, in nixpkgs unstable

โœจ 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

๐ŸŒŸ 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