unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: mathias.dahl@gmail.com, teirllm@dms.auburn.edu,
	ralphm@members.fsf.org,
	YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>,
	emacs-devel@gnu.org
Subject: Re: Building Emacs overflowed pure space
Date: Thu, 20 Jul 2006 11:34:31 +0200	[thread overview]
Message-ID: <m33bcwhb6g.fsf@kfs-l.imdomain.dk> (raw)
In-Reply-To: <E1G3JOb-0002Kh-51@fencepost.gnu.org> (Richard Stallman's message of "Wed, 19 Jul 2006 17:15:53 -0400")

Richard Stallman <rms@gnu.org> writes:

> I see no good reason why each expansion of `dolist' should use a
> different symbol.  Maybe we can arrange to use one symbol over and
> over again.  Does this work?

I'm getting confused now (the summer heat here is draining).

Why is make-symbol used in dolist at all?  The benefit seems
infinitesimal to me, and in particular if you now suggest that we
should intern another variable just to hold the uninterned symbol.


Current version:

(defmacro dolist (spec &rest body)
  "Loop over a list.
Evaluate BODY with VAR bound to each car from LIST, in turn.
Then evaluate RESULT to get return value, default nil.

\(fn (VAR LIST [RESULT]) BODY...)"
  (declare (indent 1) (debug ((symbolp form &optional form) body)))
  (let ((temp (make-symbol "--dolist-temp--")))
    `(let ((,temp ,(nth 1 spec))
	   ,(car spec))
       (while ,temp
	 (setq ,(car spec) (car ,temp))
	 (setq ,temp (cdr ,temp))
	 ,@body)
       ,@(if (cdr (cdr spec))
	     `((setq ,(car spec) nil) ,@(cdr (cdr spec)))))))


Why isn't the following version just as good?

(defmacro dolist (spec &rest body)
  "Loop over a list.
Evaluate BODY with VAR bound to each car from LIST, in turn.
Then evaluate RESULT to get return value, default nil.

\(fn (VAR LIST [RESULT]) BODY...)"
  (declare (indent 1) (debug ((symbolp form &optional form) body)))
  `(let ((--dolist-temp-- ,(nth 1 spec))
	 ,(car spec))
     (while --dolist-temp--
       (setq ,(car spec) (car --dolist-temp--))
       (setq --dolist-temp-- (cdr --dolist-temp--))
       ,@body)
     ,@(if (cdr (cdr spec))
	   `((setq ,(car spec) nil) ,@(cdr (cdr spec))))))


>
>
>
> (defvar dolist-temp-var nil)
>
> (defmacro dolist (spec &rest body)
>   "Loop over a list.
> Evaluate BODY with VAR bound to each car from LIST, in turn.
> Then evaluate RESULT to get return value, default nil.
>
> \(fn (VAR LIST [RESULT]) BODY...)"
>   (declare (indent 1) (debug ((symbolp form &optional form) body)))
>   (unless dolist-temp-var
>     (setq dolist-temp-var (make-symbol "--dolist-temp--")))
>   (let ((temp dolist-temp-var))
>     `(let ((,temp ,(nth 1 spec))
> 	   ,(car spec))
>        (while ,temp
> 	 (setq ,(car spec) (car ,temp))
> 	 (setq ,temp (cdr ,temp))
> 	 ,@body)
>        ,@(if (cdr (cdr spec))
> 	     `((setq ,(car spec) nil) ,@(cdr (cdr spec)))))))

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

  parent reply	other threads:[~2006-07-20  9:34 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-18  8:38 Building Emacs overflowed pure space Mathias Dahl
2006-07-18  9:02 ` Ralph Moritz
2006-07-18 12:06   ` Mathias Dahl
2006-07-18 13:37     ` David Hansen
2006-07-18 15:00   ` Richard Stallman
2006-07-18 18:55     ` Luc Teirlinck
2006-07-18 20:16       ` Eli Zaretskii
2006-07-18 20:56         ` Stefan Monnier
2006-07-19  2:51           ` Eli Zaretskii
2006-07-19  4:35             ` Stefan Monnier
2006-07-19  4:42             ` Miles Bader
2006-07-19 18:13               ` Eli Zaretskii
2006-07-19 13:52           ` mituharu
2006-07-19 15:07             ` Stefan Monnier
2006-07-19 21:16             ` Richard Stallman
2006-07-20  1:12               ` YAMAMOTO Mitsuharu
2006-07-22  9:06             ` YAMAMOTO Mitsuharu
2006-07-22 16:03               ` Stefan Monnier
2006-07-22 23:11                 ` Kim F. Storm
2006-07-23  3:47                   ` Stefan Monnier
2006-07-25  1:14                   ` YAMAMOTO Mitsuharu
2006-07-25  4:13                     ` Richard Stallman
2006-07-25 10:41                       ` YAMAMOTO Mitsuharu
2006-07-25 10:56                         ` David Kastrup
2006-07-25 11:00                           ` Andreas Schwab
2006-07-25 11:05                             ` David Kastrup
     [not found]                             ` <85ejwahrqi.fsf@lola.goethe.zz>
2006-07-25 11:08                               ` Andreas Schwab
2006-07-25 11:23                                 ` David Kastrup
2006-07-23  5:26               ` Richard Stallman
2006-07-18 22:01         ` Luc Teirlinck
2006-07-18 23:44           ` Chong Yidong
2006-07-19  0:06             ` Luc Teirlinck
2006-07-19  0:14               ` Luc Teirlinck
2006-07-19  0:21               ` Luc Teirlinck
2006-07-19  2:56           ` Eli Zaretskii
2006-07-18 19:29     ` Luc Teirlinck
2006-07-19  6:04       ` Richard Stallman
2006-07-19  9:22         ` YAMAMOTO Mitsuharu
2006-07-19  9:46           ` YAMAMOTO Mitsuharu
2006-07-19 15:05             ` Stefan Monnier
2006-07-19 23:13               ` Kim F. Storm
2006-07-20  4:05                 ` Stefan Monnier
2006-07-20  2:13               ` YAMAMOTO Mitsuharu
2006-07-20  2:21               ` Richard Stallman
2006-07-20  2:21               ` Richard Stallman
2006-07-20  4:07                 ` Stefan Monnier
2006-07-20  8:14                   ` Kim F. Storm
2006-07-20 15:26                     ` Stefan Monnier
2006-07-20 18:16                       ` Richard Stallman
2006-07-19 21:15           ` Richard Stallman
2006-07-19 22:47             ` Kim F. Storm
2006-07-20 15:33               ` Richard Stallman
2006-07-20  9:34             ` Kim F. Storm [this message]
2006-07-20  9:58               ` David Kastrup
2006-07-20 11:35                 ` Kim F. Storm
2006-07-20 13:46                   ` David Kastrup
2006-07-20 18:16               ` Richard Stallman
2006-07-21  8:36                 ` Kim F. Storm
2006-07-21 19:36                   ` Richard Stallman
2006-07-21 19:48                     ` David Kastrup
2006-07-21 20:40                       ` Andreas Schwab
2006-07-21 20:49                         ` David Kastrup
2006-07-22 15:49                       ` Richard Stallman
2006-07-20 16:03             ` Stefan Monnier
2006-07-20 21:46               ` Richard Stallman
2006-07-20 22:11                 ` Stefan Monnier
2006-07-21  4:46                   ` Richard Stallman
2006-07-21 12:57                     ` Stefan Monnier
2006-07-21 19:37                       ` Richard Stallman
2006-07-19  0:44 ` Katsumi Yamaoka
  -- strict thread matches above, loose matches on Subject: below --
2006-08-07 13:30 Klaus Zeitler
2006-08-08  9:20 ` Klaus Zeitler

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m33bcwhb6g.fsf@kfs-l.imdomain.dk \
    --to=storm@cua.dk \
    --cc=emacs-devel@gnu.org \
    --cc=mathias.dahl@gmail.com \
    --cc=mituharu@math.s.chiba-u.ac.jp \
    --cc=ralphm@members.fsf.org \
    --cc=teirllm@dms.auburn.edu \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).