- marked as enhancement
Implement 'div', 'mod', and 'div-and-mod' in Scheme
If x1 and x2 are exact, x2 must not be zero. These procedures implement number-theoretic integer division, with the div operation being related to quotient and the mod operation being related to remainder or modulo, but in both cases extended to handle real numbers.
( http://www.scheme.com/tspl4/objects.html#./objects:s99 )
(div 17 3)
Traceback (most recent call last):
File "stdin", line 1, col 2
RunTimeError: unbound variable 'div'
(mod 17 3)
Traceback (most recent call last):
File "stdin", line 1, col 2
RunTimeError: unbound variable 'mod'
(div-and-mod 17.5 3)
Traceback (most recent call last):
File "stdin", line 1, col 2
RunTimeError: unbound variable 'div-and-mod'
Comments (2)
-
-
- changed status to resolved
Scheme: implement mod and div (div-and-mod requires returning multiple values; delaying implementing that); fixes
#61→ <<cset 4a05a42b9b92>>
- Log in to comment