all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: Elisp / C inconsistency for reading "1."
Date: Sat, 15 Mar 2014 17:43:44 +0100	[thread overview]
Message-ID: <87siqje7jz.fsf@fencepost.gnu.org> (raw)
In-Reply-To: 85vbvf8m3j.fsf@iznogoud.viz

Wolfgang Jenkner <wjenkner@inode.at> 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




  reply	other threads:[~2014-03-15 16:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14 12:13 Elisp / C inconsistency for reading "1." Oleh Krehel
2014-03-14 14:30 ` Paul Eggert
2014-03-14 16:46   ` Stefan
2014-03-15 16:21     ` Wolfgang Jenkner
2014-03-15 16:43       ` David Kastrup [this message]
2014-03-15 18:39       ` Simon Leinen
2014-03-16  1:31       ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87siqje7jz.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.