From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.emacs.help Subject: Re: if vs. when vs. and: style question Date: Fri, 27 Mar 2015 10:20:51 +0100 Message-ID: <20150327092051.GA29050@tuxteam.de> References: <87twx9360u.fsf@kuiper.lan.informatimago.com> <0d1d19ab-06e9-462d-8867-9a49b1e232d3@googlegroups.com> <87lhil2io1.fsf@kuiper.lan.informatimago.com> <87zj6zw0wy.fsf@debian.uxu> <21781.3549.847754.15154@mail.eng.it> <20150327080635.GA26613@tuxteam.de> <21781.4268.11187.318737@mail.eng.it> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; x-action=pgp-signed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1427448104 3123 80.91.229.3 (27 Mar 2015 09:21:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Mar 2015 09:21:44 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, Emanuel Berg To: Gian Uberto Lauri Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 27 10:21:37 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 1YbQRy-00051O-Rd for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Mar 2015 10:21:10 +0100 Original-Received: from localhost ([::1]:49021 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbQRy-0001Be-3V for geh-help-gnu-emacs@m.gmane.org; Fri, 27 Mar 2015 05:21:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbQRm-00016x-7Y for help-gnu-emacs@gnu.org; Fri, 27 Mar 2015 05:20:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbQRh-0005hb-W1 for help-gnu-emacs@gnu.org; Fri, 27 Mar 2015 05:20:58 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:44271 helo=tomasium.tuxteam.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbQRh-0005hA-Qg for help-gnu-emacs@gnu.org; Fri, 27 Mar 2015 05:20:53 -0400 Original-Received: from tomas by tomasium.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1YbQRf-0007gB-DR; Fri, 27 Mar 2015 10:20:51 +0100 In-Reply-To: <21781.4268.11187.318737@mail.eng.it> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 5.199.139.25 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:103384 Archived-At: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Fri, Mar 27, 2015 at 09:11:24AM +0100, Gian Uberto Lauri wrote: > tomas@tuxteam.de writes: [...] > > That depends on the compiler. OTOH -- for a decent modern compiler, the > > code generator would see the same, whether you type (+ 1 foo) or (1+ foo). > > Thank you very much. To stay on topic (and to take the handwaving a bit out of the thread ;-), just fire up a fairly recent Emacs, go to the *scratch* buffer (which should've come up as default anyway), and type the following: (defun incr (x) (1+ x)) With the cursor at the end of the expression, type "C-x e" (that is eval-last-sexp). You should see something in the echo area confirming that Emacs has grokked that. Just below, type this: (disassemble 'incr) closing off with "C-x e", as before. What do you see? Your function, expressed as Emacs Lisp bytecodes (in a separate buffer). Something like: byte code for incr: args: (x) 0 varref x 1 add1 2 return So hm. It seems: Elisp's byte code *has* a special instruction for "increment by one", called, not surprisingly "add1". Now repeat the experiment with the following, slightly modified lines: (defun inc1 (x) (+ 1 x)) (disassemble 'inc1) What's your result? What conclusions do you draw from that? *My* point is: Emacs isn't just an editor (although it's very good at that). It is an extremely discoverable programming environment. Just play with it. It'll go out of its way to help you access its innards. Regards - -- tomás -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlUVIPMACgkQBcgs9XrR2kY0JACfZnn7SMUzFtjnBFHIXtDPXypr 7BQAn1g+gpQfVC323+/3sLFNdMufnvH5 =gLJC -----END PGP SIGNATURE-----