emacs-devel
[Top][All Lists]
Advanced

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

Re: dotimes-with-progress-reporter doc string lacks SPEC


From: Lennart Borgman
Subject: Re: dotimes-with-progress-reporter doc string lacks SPEC
Date: Thu, 06 Jul 2006 23:48:22 +0200
User-agent: Thunderbird 1.5.0.4 (Windows/20060516)

Mathias Dahl wrote:
Well, the same applies to `dotimes'.

This is interesting. Here is the source for the `dotimes' macro:

(defmacro dotimes (spec &rest body)
 "Loop a certain number of times.
Evaluate BODY with VAR bound to successive integers from 0, inclusive,
to COUNT, exclusive.  Then evaluate RESULT to get return value, default
nil.

\(fn (VAR COUNT [RESULT]) BODY...)"
 (let ((temp (make-symbol "--cl-dotimes-temp--")))
   (list 'block nil
      (list* 'let (list (list temp (nth 1 spec)) (list (car spec) 0))
         (list* 'while (list '< (car spec) temp)
            (append body (list (list 'incf (car spec)))))
         (or (cdr (cdr spec)) '(nil))))))

It mentiones `spec', which I think Lennart wants to know more about.

When loaded (or is it compiled?) though (I just made a dummy call to
it), the documentation string says this:

dotimes is a Lisp macro in `cl-macs'.
(dotimes (VAR COUNT [RESULT]) BODY...)

Loop a certain number of times.
Evaluate BODY with VAR bound to successive integers from 0, inclusive,
to COUNT, exclusive.  Then evaluate RESULT to get return value, default
nil.

Not mentioning any `spec' at all.

Anyone care to explain this magic?

Hm, thanks. I can see the pattern. Searching elisp Info I found the explanation in "(elisp) Function Documentation":

  The last line of the documentation string can specify calling
  conventions different from the actual function arguments.  Write text
 like this:

    \(fn ARGLIST)

 ...




reply via email to

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