newLISP Fan Club

Forum => Anything else we might add? => Topic started by: Thorstein on June 04, 2021, 09:29:43 AM

Title: (read-expr "08") reads octal?
Post by: Thorstein on June 04, 2021, 09:29:43 AM
This behavior was a little unexpected.



newLISP v.10.7.5 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h



> (read-expr "08")

0

> (read-expr "07")

7

> (read-expr "06")

6

> (read-expr "09")

0

> (eval-string "08")

8

> (eval-string "09")

9

> (read-expr "08")

0

> $count

1

> (read-expr "07")

7

> $count

2

>
Title: Re: (read-expr "08") reads octal?
Post by: rickyboy on June 04, 2021, 02:02:49 PM
It says in the manual that those expressions are octal.
Title: Re: (read-expr "08") reads octal?
Post by: Thorstein on June 28, 2021, 03:43:11 PM
Aha!:

"Octals start with an optional + (plus) or - (minus) sign and a 0 (zero), followed by any combination of the octal digits: 01234567. Any other character ends the octal number. Only up to 21 octal digits are valid and any more digits are ignored."



Thanks.