all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Clément Pit--Claudel" <clement.pit@gmail.com>
To: Dmitry Gutov <dgutov@yandex.ru>, emacs-devel@gnu.org
Subject: Re: On removing some obsolete code from subr and core
Date: Sat, 5 Nov 2016 13:23:58 -0400	[thread overview]
Message-ID: <41464b49-e4de-3011-8a44-8e50f336a67d@gmail.com> (raw)
In-Reply-To: <99b16586-4ce6-6837-d3e7-58a84b1ddd35@yandex.ru>


[-- Attachment #1.1: Type: text/plain, Size: 921 bytes --]

On 2016-11-05 12:42, Dmitry Gutov wrote:
> On 05.11.2016 17:52, Clément Pit--Claudel wrote:
> 
>> I never understood this one.  The name string-to-int suggests that you'll get an error if your string doesn't describe an int.
> 
> I'm just guessing, but that probably never happened. stirng-to-number works like this:
> 
> ELISP> (string-to-number "abc")
> 0 (#o0, #x0, ?\C-@)
> ELISP> (string-to-number "22.2abc")
> 22.2

I know, I know :) (what is this fancy ELISP repl, btw?)

>> How do you get a proper string-to-int behavior in Emacs Lisp? With (let ((v (string-to-number s))) (when (floatp v) (error …)))?
> 
> By calling `floor' on the result of string-to-number, I guess.

Hmm. I'd expect string-to-int to error on non-ints:

>>> int("1.3")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '1.3'

Clément.




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-11-05 17:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-04 16:59 On removing some obsolete code from subr and core Mark Oteiza
2016-11-05  8:24 ` John Wiegley
2016-11-05  8:34 ` Eli Zaretskii
2016-11-05 13:50   ` Mark Oteiza
2016-11-05 17:59     ` Eli Zaretskii
2016-11-06 16:58       ` Mark Oteiza
2016-11-05 17:50   ` Stefan Monnier
2016-11-06 17:05     ` Mark Oteiza
2016-11-06 22:32       ` Stefan Monnier
2016-11-07  0:32   ` Mark Oteiza
2016-11-07  3:35     ` Eli Zaretskii
2016-11-07  4:24       ` Mark Oteiza
2016-11-07 15:11         ` Eli Zaretskii
2016-11-07 20:08           ` Mark Oteiza
2016-11-07 20:13             ` Eli Zaretskii
2016-11-07 20:25               ` Mark Oteiza
2016-11-08  6:51                 ` Noam Postavsky
2016-11-07 20:31             ` Stefan Monnier
2016-11-07 21:32               ` Johan Bockgård
2016-11-08 13:00                 ` Stefan Monnier
2016-11-08 19:49                   ` John Wiegley
2016-11-05 15:51 ` Clément Pit--Claudel
2016-11-05 15:52 ` Clément Pit--Claudel
2016-11-05 16:42   ` Dmitry Gutov
2016-11-05 17:23     ` Clément Pit--Claudel [this message]
2016-11-05 17:31       ` Dmitry Gutov
2016-11-05 18:03         ` Clément Pit--Claudel
2016-11-05 15:57 ` Clément Pit--Claudel
2016-11-05 17:56   ` Stefan Monnier
2016-11-05 19:14     ` Clément Pit--Claudel

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=41464b49-e4de-3011-8a44-8e50f336a67d@gmail.com \
    --to=clement.pit@gmail.com \
    --cc=dgutov@yandex.ru \
    --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.