[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Building Emacs overflowed pure space
From: |
David Kastrup |
Subject: |
Re: Building Emacs overflowed pure space |
Date: |
Thu, 20 Jul 2006 15:46:15 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
address@hidden (Kim F. Storm) writes:
> 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?
Uh yes.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
- Re: Building Emacs overflowed pure space, (continued)
- Re: Building Emacs overflowed pure space, Richard Stallman, 2006/07/19
- Re: Building Emacs overflowed pure space, Kim F. Storm, 2006/07/19
- Re: Building Emacs overflowed pure space, Richard Stallman, 2006/07/20
- Re: Building Emacs overflowed pure space, Kim F. Storm, 2006/07/20
- Re: Building Emacs overflowed pure space, David Kastrup, 2006/07/20
- Re: Building Emacs overflowed pure space, Kim F. Storm, 2006/07/20
- Re: Building Emacs overflowed pure space,
David Kastrup <=
- Re: Building Emacs overflowed pure space, Richard Stallman, 2006/07/20
- Re: Building Emacs overflowed pure space, Kim F. Storm, 2006/07/21
- Re: Building Emacs overflowed pure space, Richard Stallman, 2006/07/21
- Re: Building Emacs overflowed pure space, David Kastrup, 2006/07/21
- Re: Building Emacs overflowed pure space, Andreas Schwab, 2006/07/21
- Re: Building Emacs overflowed pure space, David Kastrup, 2006/07/21
- Re: Building Emacs overflowed pure space, Richard Stallman, 2006/07/22
- Re: Building Emacs overflowed pure space, Stefan Monnier, 2006/07/20
- Re: Building Emacs overflowed pure space, Richard Stallman, 2006/07/20
- Re: Building Emacs overflowed pure space, Stefan Monnier, 2006/07/20