(read-expr "08") reads octal?

For the Compleat Fan
Locked
Thorstein
Posts: 7
Joined: Tue May 26, 2015 11:30 pm

(read-expr "08") reads octal?

Post 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
>

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

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

Post by rickyboy »

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

Thorstein
Posts: 7
Joined: Tue May 26, 2015 11:30 pm

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

Post 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.

Locked