emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Building Emacs overflowed pure space


From: Kim F. Storm
Subject: Re: Building Emacs overflowed pure space
Date: Thu, 20 Jul 2006 13:35:05 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

David Kastrup <address@hidden> writes:

>
> (dolist (i '(1 2))
>   (dolist (j '(3 4))
>     [...]))

Huh?

(dolist (i '(1 2))
  (dolist (j '(3 4))
    (print (cons i j))))

=> (1 . 3) (1 . 4) (2 . 3) (2 . 4)


(defmacro dolist1 (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))))))

(dolist1 (i '(1 2))
  (dolist1 (j '(3 4))
    (print (cons i j))))

=> (1 . 3) (1 . 4) (2 . 3) (2 . 4)

.. so where's the difference?

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]