I'm trying to make the absolute value procedure and code got an error. I don't know why :/
(define (abs x)
(cond ((> x 0) x)
((= x 0) 0)
((< x 0) (- x))))
Error message:
define-values: assignment disallowed;
cannot change constant
constant: abs
The abs
procedure is already part of the language you're using and you can't create another procedure with the same name. Simply rename it (and the implementation can be simplified a bit, by the way):
(define (myabs x)
(cond ((>= x 0) x)
(else (- x))))