This should fix the problems:
(define (gcd a b)
(cond [(= b 0) a]
[else (gcd b (modulo a b))]))
You were incorrectly surrounding some expressions between parenthesis, and some parenthesis were missing from the cond
expression.
Notice that in Scheme, when you surround something in parenthesis, say (a)
you're telling the interpreter: a
is a procedure with no arguments and I want to call it, and this was not the case in here, a
is just a number.
Also, for readability's sake, it's a good idea to use []
instead of ()
to separate each of the conditions in a cond
expression, as shown in my code above - but don't forget them, they're mandatory and in your code you forgot them in the first condition.