(read-expr "08") reads octal?

Started by Thorstein, June 04, 2021, 09:29:43 AM

Previous topic - Next topic

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

>

rickyboy

#1
It says in the manual that those expressions are octal.
(λx. x x) (λx. x x)

Thorstein

#2
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.