SICP exercise 1.28 - miller-rabin primality test
To ensure I understood the SICP exercise correctly, I wrote my own version of the Miller-Rabin algorithm. You can look at my code and compare against yours.

With this in mind, here's my correctness-related feedback:


Your test expression, (and (not (= base 1)) (not (= base (- m 1))) (not (= exp (- m 1))) (= (remainder base m) 1)), seems to muddle up the relationship between the previous and current values. Really, what you want to find out is whether the previous value is between 2 and (- m 2) (mod m) and the current value is 1 (mod m).
Your (remainder (expmod (square base) (/ exp 2) m) m) is not optimal. All values returned by expmod should already be mod m so doing a further remainder call is pointless. You should, however, clamp the result of square to mod m.


Other style notes:


Not sure why you didn't just use a one-liner for the miller-rabin-test function:

(define (miller-rabin-test n)
  (= (expmod (+ 1 (random (- n 1))) (- n 1) n) 1))


or, if you're trying to break up the expression a bit,

(define (miller-rabin-test n)
  (define a (+ 1 (random (- n 1))))
  (= (expmod a (- n 1) n) 1))


No need for an internal function!
You can rewrite the main loop as a single or/and expression:

(define (fast-prime? n times)
  (or (zero? times)
      (and (miller-rabin-test n)
           (fast-prime? n (- times 1)))))