Really, really basic question (negative numbers)
Posted: Tue Apr 28, 2009 10:11 pm
Greetings.
For what I'm sure is a really basic reason, I can't get negative numbers to work. I keep getting error messages about an undefined identifier. A simple example (finding the absolute value of an integer) that's copied directly out of SICP:
(define (ab x)
(cond ((< x 0) (-x))
(else x)))
> (ab 8)
8
> (ab -8)
. . reference to undefined identifier: -x
Can someone fill me in?
Thanks,
Kevin
For what I'm sure is a really basic reason, I can't get negative numbers to work. I keep getting error messages about an undefined identifier. A simple example (finding the absolute value of an integer) that's copied directly out of SICP:
(define (ab x)
(cond ((< x 0) (-x))
(else x)))
> (ab 8)
8
> (ab -8)
. . reference to undefined identifier: -x
Can someone fill me in?
Thanks,
Kevin