I found a work around:
(define (sign x)
(if (positive? x)
1
(if (negative? x)
-1
0)))
Just started a Scheme class at my university. One of the exercises we got was to define a procedure called sign that takes one number as a parameter, and returns 1 if the number is positive, -1 if the number is negative and 0 if the number is 0.
We had to do this in two ways, the first being the use of cond, this was fairly simple and understandable seeing as the book stated that using cond is best suited for checking multiple expressions. The second way was using if, and I got sort of stuck here, I'm not sure how to check this using if. I'm new to this language, so I'm sorry if this is a bad question.