all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: emacs-devel@gnu.org
Cc: tino.calancha@gmail.com
Subject: [PATCH] Implement letrec without backquote?
Date: Sat, 05 Nov 2016 02:39:00 +0900	[thread overview]
Message-ID: <878tszkuvf.fsf@gmail.com> (raw)


Hi,

i am sorry if this question results naive.
Is there any advantage on this patch?

*) I don't see significant differences neither in performance
   nor readability: in the patch, the macro expands to just
   one setq call.  Initially, i thought this could be an advantage,
   but after running some checks i don't see differences.

*) This patch doesn't use backquote, but as longer as `letrec' is
   not used in an early stage of the bootstrap this doesn't matter.

Thank you.
Tino

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From e11cb762efa4ab7e6ea9bdc755d95d4275c6b715 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Sat, 5 Nov 2016 02:12:28 +0900
Subject: [PATCH] * lisp/subr.el (letrec):  Reimplement it without backquote

---
 lisp/subr.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index fba43be..e667e85 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1529,9 +1529,9 @@ letrec
   ;; As a special-form, we could implement it more efficiently (and cleanly,
   ;; making the vars actually unbound during evaluation of the binders).
   (declare (debug let) (indent 1))
-  `(let ,(mapcar #'car binders)
-     ,@(mapcar (lambda (binder) `(setq ,@binder)) binders)
-     ,@body))
+  (nconc (list 'let (mapcar #'car binders)
+               (apply #'append (cons '(setq) binders)))
+         body))
 
 (defmacro with-wrapper-hook (hook args &rest body)
   "Run BODY, using wrapper functions from HOOK with additional ARGS.
-- 
2.10.1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.2)
 of 2016-11-03 built on calancha-pc
Repository revision: abe594c0990a4e6bc72b20b7ff06b4b0c01a682c




             reply	other threads:[~2016-11-04 17:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-04 17:39 Tino Calancha [this message]
2016-11-05  8:26 ` [PATCH] Implement letrec without backquote? John Wiegley
2016-11-05  8:43   ` Tino Calancha
2016-11-05  8:48     ` John Wiegley
2016-11-05  9:05       ` Tino Calancha
2016-11-05 10:21         ` Andreas Schwab
2016-11-05 11:24           ` Tino Calancha
2016-11-05 17:59         ` Stefan Monnier

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=878tszkuvf.fsf@gmail.com \
    --to=tino.calancha@gmail.com \
    --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.