all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Implement letrec without backquote?
@ 2016-11-04 17:39 Tino Calancha
  2016-11-05  8:26 ` John Wiegley
  0 siblings, 1 reply; 8+ messages in thread
From: Tino Calancha @ 2016-11-04 17:39 UTC (permalink / raw)
  To: emacs-devel; +Cc: tino.calancha


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




^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-11-05 17:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-04 17:39 [PATCH] Implement letrec without backquote? Tino Calancha
2016-11-05  8:26 ` 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

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.