[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Weirdness reading integers from strings
- To: bug-mcl@cambridge.apple.com, info-mcl@cambridge.apple.com
- Subject: Weirdness reading integers from strings
- From: cornell@unix1.cs.umass.edu (Matthew Cornell)
- Date: Thu, 22 Aug 91 09:31:55 EDT
- Cc: cornell@unix1.CS.UMASS.EDU
I've discovered what I think is a bug in READ-FROM-STRING and
PARSE-INTEGER. I've included a transcript below. I'm trying to read a
negative integer embedded in a string. When I read from the string's
subsequence I get a symbol; when I read from an immedate (i.e. not
from a subsequence) I get my desired and expected result: a fixnum. I
realize "-200" could be parsed as either a symbol or a fixnum but why
the different behavior for subseqs? I also tried using PARSE-INTEGER
but it errors on "-200". I'm using mcl 2.0b1p3.
matt
? (setf str (subseq "noHardwareErr -200 Required sound hardware not available"
32 36))
"-200"
? (read-from-string str)
\-200
4
? (type-of *)
SYMBOL
? (read-from-string "-200")
-200
4
? (type-of *)
FIXNUM
? (parse-integer str)
> Error: Not an integer string: "-200".
> While executing: PARSE-INTEGER
> Type Command-. to abort.
See the Restarts menu item for further choices.
1 >
Aborted
? (parse-integer "-200")
-200
4
?