[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: math expressions (was: Re: Tail call elimination)

From: Pete Dietl
Subject: Re: math expressions (was: Re: Tail call elimination)
Date: Thu, 28 May 2020 17:07:06 -0500

Upon taking a look at gnulib, I found that they have arithmetic wrap
functions which guarantee wrapping.
We can use these functions to guarantee that overflow will just wrap around.

Let's leave the shift operators out for now.

comp is for complement. ~

In most scheme implementations, providing only one operand to the
arithmetic functions
just returns that argument, aside from subtraction, which negates the argument.

Once again I am aiming for the single argument syntax of $(math ...)

Interestingly, in Guile, (+) and (*) return 1, but (/) and (-) return
errors about invalid number of arguments.
Personally, I think no operands should result in an error.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]