Try this version, it fixes all the syntax errors:
(define (test-for-prime number divisor)
(cond ((prime? number)
number)
(else
(let ([next-divisor (find-next-divisor number (+ 1 divisor))])
(test-for-prime (/ number next-divisor) next-divisor)))))
You have lots of misplaced parenthesis. Some are missing, some are mistaken ... I'd suggest you take a good read at a Scheme tutorial and play around writing some basic procedures to get the hang of it, in particular here is the documentation and correct structure for a let
special form:
(let ([id val-expr] ...) body ...+)
The first form evaluates the val-exprs left-to-right, creates a new location for each id, and places the values into the locations. It then evaluates the bodys, in which the ids are bound. The last body expression is in tail position with respect to the let form. The ids must be distinct according to bound-identifier=?
Also it's a good idea to use an IDE/editor which highlights this kind of problems and helps you indent the code properly. In particular, be aware that a variable must not be surrounded in parenthesis, when you write this: (x)
Scheme assumes that x
is a procedure and that you're calling it.