All pastes #203998 Raw Edit

Mine

public text v1 · immutable
#203998 ·published 2006-10-15 15:55 UTC
rendered paste body
(define (double n) (+ n n))

(define (addRemainder n)
  (cond
    [(equal? n 1) n]
    [else (+ n (addRemainder (quotient n 2)))]))

(define (multiply n x)
  (cond
    [(or (zero? x) (zero? n)) 0]
    [(equal? x 1) (addRemainder n)]
    [else (multiply (double n) (quotient x 2))]))