From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: no empty (zero) string predicate in Elisp Date: Sat, 25 Apr 2015 22:52:00 -0400 Message-ID: References: <87h9s4rhx5.fsf@debian.uxu> <874mo4jmb7.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1430016763 13627 80.91.229.3 (26 Apr 2015 02:52:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Apr 2015 02:52:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 26 04:52:34 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YmCgJ-0004TV-67 for geh-help-gnu-emacs@m.gmane.org; Sun, 26 Apr 2015 04:52:31 +0200 Original-Received: from localhost ([::1]:49767 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmCgI-0001eU-MP for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Apr 2015 22:52:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmCg6-0001eD-QJ for help-gnu-emacs@gnu.org; Sat, 25 Apr 2015 22:52:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YmCg3-0006o5-Ij for help-gnu-emacs@gnu.org; Sat, 25 Apr 2015 22:52:18 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:36277) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YmCg3-0006nq-Bi for help-gnu-emacs@gnu.org; Sat, 25 Apr 2015 22:52:15 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YmCg0-00045f-QO for help-gnu-emacs@gnu.org; Sun, 26 Apr 2015 04:52:12 +0200 Original-Received: from 76-10-168-214.dsl.teksavvy.com ([76.10.168.214]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Apr 2015 04:52:12 +0200 Original-Received: from monnier by 76-10-168-214.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Apr 2015 04:52:12 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 26 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 76-10-168-214.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:TddIX3/xJqDtl/9zsgcFiz4xRMI= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103998 Archived-At: > Both for fundamental reasons, cardinals are built from a zero and a > successor relationship, therefore a predicate for zero is not stupid, > and a 1+ function neither; I know that you can model natural numbers from 0 and successor, but Elisp integers have very little to do with it and are not encoded in this way, and there isn't much code around that looks at them this way. So, as much as I like this way to look at the world, I don't find it helpful for Elisp. > and for optimization reasons on simplistic > compilers: the hardware usually HAS specific (and optimized) > instructions to test for zero and another to increment. C-h f zerop RET says: zerop is a compiled Lisp function in `subr.el'. [...] This function has a compiler macro `zerop--anon-cmacro'. and if you look at this mysterious zerop--anon-cmacro, you'll see that it optimizes `zerop' by rewriting it to (= 0 ...), which is implemented more efficiently. Stefan