fx+(3scm)

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

✨ fx+, fx* ✨

okay so bestie, you're looking at fx+ and fx* from the Scheme Programmer's Manual β€” yes that's the manual name, we're fancy here πŸ’… β€” and honestly? these two are the moment. fixnum addition and multiplication, literally that's it, that's the whole vibe. πŸŽ€


πŸ’– LIBRARY πŸ’–

where do you even get these queens from? two places, pick your fighter:

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

both are R6RS, no notes, slay 🫢


🌸 SYNOPSIS 🌸

the whole entire plot, right here:

(fx+ fx1 fx2)
(fx* fx1 fx2)

two args, no drama, no extra credit πŸ’€


πŸ¦‹ DESCRIPTION πŸ¦‹

so these procedures return the sum or product of their arguments β€” provided that sum or product is a fixnum. like, that's the deal, that's the contract. if the answer fits in fixnum-land, you're golden ✨. if it doesn't... we'll get to that in errors, and bestie, it's giving consequences 😭


πŸ“ RETURN VALUES πŸ“

the sum or product of the arguments. periodt. πŸ‘‘


🌈 EXAMPLES 🌈

watch her work, no cap:

(fx+ 2 3)                  => 5
(fx* 2 3)                  => 6
(fx+ (greatest-fixnum) 1)  => &implementation-restriction exception
(fx* (least-fixnum) -1)    => &implementation-restriction exception

see how the first two are just living their best life? and then (fx+ (greatest-fixnum) 1) walks right off the edge of fixnum-town and gets an &implementation-restriction exception. same energy with (fx* (least-fixnum) -1) πŸ’€ like bestie, you overflowed, that's on you, not me πŸ™ˆ


⭐ ERRORS ⭐

this procedure can raise exceptions with the following condition types β€” listen up, this is the important part:

  • &implementation-restriction β€” raised when the sum or product is not a fixnum. aka you pushed her past fixnum range and she said "no ❀️" and threw an exception at you.
  • &assertion β€” raised when an argument is not a fixnum. aka you handed her the wrong type entirely and she's not about to pretend that's okay. 🫠
fr fr, keep an eye on both of these β€” one is "too big/little" and one is "wrong type," and they are not the same thing, iykyk πŸ’…

🧚 STANDARDS 🧚

R6RS ✨ that's the one, we stan an official standard πŸ‘‘


πŸ‘‘ SEE ALSO πŸ‘‘

  • fixnums(7scm) β€” go read this too, it's the whole fixnum cinematic universe πŸ”₯

πŸ’œ AUTHORS πŸ’œ

this page is part of the scheme-manpages project 🌸 β€” it includes materials from the RnRS documents, and more information can be found at https://github.com/schemedoc/manpages/. go check it out, the whole squad is there 🫢


and that's the page bestie, dated 2020-04-18 because that's when this icon was born, from the Scheme Programmer's Manual β€” fx+(3scm). mwah, go add some fixnums πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from