fx+(3scm)
β¨ 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
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2020 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms