[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Elisp / C inconsistency for reading "1."
From: |
David Kastrup |
Subject: |
Re: Elisp / C inconsistency for reading "1." |
Date: |
Sat, 15 Mar 2014 17:43:44 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Wolfgang Jenkner <address@hidden> writes:
> On Fri, Mar 14 2014, Stefan wrote:
>
>>> More important, it feels wrong coming from a Lisp background, as Common Lisp
>>> and Scheme both interpret "1." to be a floating point number. I would
>>> support changing Emacs Lisp to be consistent with common practice, as there
>>> seems no point to being different and there are advantages to being
>>> consistent. (Not during the feature freeze though, of course.)
>>
>> I'd tend to agree, indeed.
>
> But please don't base your opinion on a wrong assumption about Common
> Lisp, see [1],
>
> Integers can be written as a sequence of digits [...]
> optionally followed by a decimal point;
>
> And, to be really pedantic, let's add that `integer' and `float' are
> disjoint types, see [2],
>
> The types rational and float are disjoint subtypes of type real.
>
> and [3],
>
> The types integer and ratio are disjoint subtypes of type
> rational.
>
> This remark is actually pertinent here, because the emacs CL package
> seems to emulate these type relations (as far as corresponding objects
> exist in emacs-lisp).
>
> (cl-typep 1. 'integer)
> => t
> (cl-typep 1. 'float)
> => nil
>
> [1] http://www.lispworks.com/documentation/HyperSpec/Body/02_cbaa.htm
> [2] http://www.lispworks.com/documentation/HyperSpec/Body/t_real.htm
> [3] http://www.lispworks.com/documentation/HyperSpec/Body/t_ration.htm
And indeed:
$ clisp
i i i i i i i ooooo o ooooooo ooooo ooooo
I I I I I I I 8 8 8 8 8 o 8 8
I \ `+' / I 8 8 8 8 8 8
\ `-+-' / 8 8 8 ooooo 8oooo
`-__|__-' 8 8 8 8 8
| 8 o 8 8 o 8 8
------+------ ooooo 8oooooo ooo8ooo ooooo 8
Welcome to GNU CLISP 2.49 (2010-07-07) <http://clisp.cons.org/>
Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2010
Type :h and hit Enter for context help.
[1]> 1.
1
[2]> 1.0
1.0
[3]>
--
David Kastrup