1; SketchyLISP Library
2; Copyright (C) 2005,2006,2007 Nils M Holm. All rights reserved.
3; See the file LICENSE of the SketchyLISP distribution
4; for conditions of use.
5
6; ---name---
7; remainder
8
9; ---conformance---
10; R5RS
11
12; ---purpose---
13; Compute the division remainder of two numbers.
14
15; ---args---
16; A - number (dividend)
17; B - number (divisor)
18
19; ---keywords---
20; REMAINDER function, division, remainder, division remainder
21; modulus, arithmetics
22
23; ---see-also---
24; digits, quotient, modulo, divide, +, -, *, nremainder
25
26; ---example---
27; (remainder 123 -23) => 8
28
29(define remainder #t)
30
31(require "divide.scm")
32(require "caar.scm") ; cadr
33
34; ---code---
35(define (remainder a b)
36  (cadr (divide a b)))
37