[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Implement letrec without backquote?
From: |
Tino Calancha |
Subject: |
[PATCH] Implement letrec without backquote? |
Date: |
Sat, 05 Nov 2016 02:39:00 +0900 |
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 <address@hidden>
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
- [PATCH] Implement letrec without backquote?,
Tino Calancha <=