isicp
isicp copied to clipboard
Exercise 2.5 not working
My code works but is not correctly evaluated. This occurs in other exercises as well.
(define (cons a b)
(* (expt 2 a)
(expt 3 b)))
(define (val n i)
(if (zero? (modulo n i))
(+ 1 (val (/ n i) i))
0
)
)
(define (car p) (val p 2))
(define (cdr p) (val p 3))