Page 1 of 1

(read-expr "08") reads octal?

Posted: Fri Jun 04, 2021 4:29 pm
by Thorstein
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
>

Re: (read-expr "08") reads octal?

Posted: Fri Jun 04, 2021 9:02 pm
by rickyboy
It says in the manual that those expressions are octal.

Re: (read-expr "08") reads octal?

Posted: Mon Jun 28, 2021 10:43 pm
by Thorstein
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.