fixnum?(3scm)

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

πŸ’… fixnum?(3scm) β€” a page from the Scheme Programmer's Manual

okay so bestie, welcome to the fixnum? page, from the Scheme Programmer's Manual. yes this is the whole vibe. let's get into it ✨

🌸 NAME

fixnum? β€” test if an object is a fixnum, girl. that's it. that's the job.


πŸŽ€ LIBRARY

import it from either of these, depending on the flavor of Scheme you're living in:

(import (rnrs))                     ;R6RS
(import (rnrs arithmetic fixnums))  ;R6RS

both are R6RS btw, so no cap on which one you pick πŸ’–

✨ SYNOPSIS

(fixnum? obj)

one argument, one question: is it a fixnum or not πŸ”₯

πŸ’œ DESCRIPTION

so fixnum? returns #t if obj is an exact integer object within the fixnum range β€” and #f otherwise. that's literally the entire storyline. main character energy of "is this thing one of us" 🫢

🧚 IMPLEMENTATION NOTES

the fixnum range is implementation-dependent, bestie. it's not the same everywhere. if you need to know the actual numbers, check fixnum-width(3scm) β€” it'll tell you how wide your fixnums are.

heads up: "implementation-dependent" means don't assume, ok? your fixnum range is not universal. iykyk 😭

πŸ¦‹ RETURN VALUES

returns a single boolean object as per the description. one boolean, that's it, no extras, no sneaky second value πŸ’…

🌈 EXAMPLES

here's the receipts, all spelled out exactly:

(fixnum? 0)            => #t
(fixnum? (expt 2 20))  => #t
(fixnum? #f)           => #f
(fixnum? "123")        => #f
(fixnum? (fx+ a 1))
    => #t or &implementation-restriction

see how #f and "123" both get a big fat #f? yeah. wrong vibe entirely. and that last one β€” (fx+ a 1) β€” can give you #t or &implementation-restriction. it's giving "situationship", it's giving "depends" πŸ™ˆ

πŸ‘‘ 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. so like, don't do that πŸ’€
  • 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, catastrophically. that's the actual word. not me being dramatic, that's just in the spec πŸ”₯

πŸ“ SEE ALSO

πŸ’– STANDARDS

R6RS. periodt.

🫢 AUTHORS

this page is part of the scheme-manpages project. it includes materials from the RnRS documents. more info can be found at https://github.com/schemedoc/manpages/. love that for them πŸ’œ


and that's the page, bestie β€” dated 2021-01-17, footer says fixnum?(3scm) right back at you. slay, go check your fixnums πŸŒΈπŸ’…βœ¨

πŸ“¦ where this page comes from