some solutions for MIT Press's "structure and interpretation of computer programs", I guess
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
242 B

(define (double x)
(+ x x))
(define (halve x)
(/ x 2))
(define (nice-mult a b)
(cond ((zero? b) 0)
((even? b) (double (nice-mult a (halve b))))
(else (+ a (nice-mult a (- b 1))))))
(display (nice-mult 3 3))
(newline)