18 lines
340 B
Scheme
18 lines
340 B
Scheme
(define (assert a b)
|
|
(cond ((equal? a b) (display "[ok]"))
|
|
(else
|
|
(display "[error] ")
|
|
(display a)
|
|
(display " != ")
|
|
(display b)))
|
|
(newline))
|
|
|
|
(define (gcd a b)
|
|
(if (= b 0) (abs a) (gcd b (remainder a b))))
|
|
|
|
(define (average a b) (/ (+ a b) 2.0))
|
|
(define (id n) n)
|
|
(define (inc n) (+ n 1))
|
|
(define nil '())
|
|
|