How do you name an integer in Scheme?
Most often, you just use an ordinary numeral, a sequence of digits such as
3 or 5280 or
872163987619823698718981709721364981. Don't put any commas or
spaces in the middle of the numeral, no matter how large it is -- Scheme
will misinterpret such punctuation.
Does it make any difference if I have extra zeroes at the beginning of a numeral?
No. The numeral 0000475 names exactly the same integer as the
numeral 475.
What about negative integers?
Just put a minus sign on the front: -72. Make sure it
immediately precedes the first digit, with no intervening space -- a minus
sign separated from a numeral by a space has a different meaning (usually,
it denotes the subtraction procedure).
Should I use a plus sign to indicate that a number is positive?
You may, if you like, but you needn't; +91446 names the
same integer as plain old 91446.
Is there any difference between -0 and +0?
No. -0, +0, and 0 are all names for
the same integer.
Is there anything else I need to know?
Probably not. If you want to get fancy, Scheme also provides binary, octal, and hexadecimal numerals and inexact numerals for values that are known only approximately.
Next topic
Previous topic
Table of contents
This document is available on the World Wide Web as
http://www.math.grin.edu/~stone/scheme-web/integer-numerals.html