aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-01-28 22:42:15 +0000
committerDave Love2000-01-28 22:42:15 +0000
commit7e16e199058bde427aa7c2839a596343a174e40c (patch)
tree04cb1c993ffbed29d491ec10fc7f1adb9c10873b
parent7df8508400b15fe2b5c1e6768f34e7d0ecf6b0f2 (diff)
downloademacs-7e16e199058bde427aa7c2839a596343a174e40c.tar.gz
emacs-7e16e199058bde427aa7c2839a596343a174e40c.zip
Remove dotimes, dolist.
-rw-r--r--lisp/emacs-lisp/cl-macs.el26
-rw-r--r--man/cl.texi27
2 files changed, 4 insertions, 49 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 85287507f58..63354c861ef 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1122,32 +1122,6 @@ Format is: (do* ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
1122 (apply 'append sets))))))) 1122 (apply 'append sets)))))))
1123 (or (cdr endtest) '(nil))))) 1123 (or (cdr endtest) '(nil)))))
1124 1124
1125(defmacro dolist (spec &rest body)
1126 "(dolist (VAR LIST [RESULT]) BODY...): loop over a list.
1127Evaluate BODY with VAR bound to each `car' from LIST, in turn.
1128Then evaluate RESULT to get return value, default nil."
1129 (let ((temp (gensym "--dolist-temp--")))
1130 (list 'block nil
1131 (list* 'let (list (list temp (nth 1 spec)) (car spec))
1132 (list* 'while temp (list 'setq (car spec) (list 'car temp))
1133 (append body (list (list 'setq temp
1134 (list 'cdr temp)))))
1135 (if (cdr (cdr spec))
1136 (cons (list 'setq (car spec) nil) (cdr (cdr spec)))
1137 '(nil))))))
1138
1139(defmacro dotimes (spec &rest body)
1140 "(dotimes (VAR COUNT [RESULT]) BODY...): loop a certain number of times.
1141Evaluate BODY with VAR bound to successive integers from 0, inclusive,
1142to COUNT, exclusive. Then evaluate RESULT to get return value, default
1143nil."
1144 (let ((temp (gensym "--dotimes-temp--")))
1145 (list 'block nil
1146 (list* 'let (list (list temp (nth 1 spec)) (list (car spec) 0))
1147 (list* 'while (list '< (car spec) temp)
1148 (append body (list (list 'incf (car spec)))))
1149 (or (cdr (cdr spec)) '(nil))))))
1150
1151(defmacro do-symbols (spec &rest body) 1125(defmacro do-symbols (spec &rest body)
1152 "(dosymbols (VAR [OBARRAY [RESULT]]) BODY...): loop over all symbols. 1126 "(dosymbols (VAR [OBARRAY [RESULT]]) BODY...): loop over all symbols.
1153Evaluate BODY with VAR bound to each interned symbol, or to each symbol 1127Evaluate BODY with VAR bound to each interned symbol, or to each symbol
diff --git a/man/cl.texi b/man/cl.texi
index 27eeb23c82b..873526a6235 100644
--- a/man/cl.texi
+++ b/man/cl.texi
@@ -970,7 +970,7 @@ constructs.
970* Variable Bindings:: `progv', `lexical-let', `flet', `macrolet' 970* Variable Bindings:: `progv', `lexical-let', `flet', `macrolet'
971* Conditionals:: `case', `typecase' 971* Conditionals:: `case', `typecase'
972* Blocks and Exits:: `block', `return', `return-from' 972* Blocks and Exits:: `block', `return', `return-from'
973* Iteration:: `do', `dotimes', `dolist', `do-symbols' 973* Iteration:: `do', `do-symbols'
974* Loop Facility:: The Common Lisp `loop' macro 974* Loop Facility:: The Common Lisp `loop' macro
975* Multiple Values:: `values', `multiple-value-bind', etc. 975* Multiple Values:: `values', `multiple-value-bind', etc.
976@end menu 976@end menu
@@ -1924,7 +1924,7 @@ mylist
1924 1924
1925@noindent 1925@noindent
1926In this example, the @code{my-dolist} macro is similar to @code{dolist} 1926In this example, the @code{my-dolist} macro is similar to @code{dolist}
1927(@pxref{Iteration}) except that the variable @code{x} becomes a true 1927except that the variable @code{x} becomes a true
1928reference onto the elements of the list. The @code{my-dolist} call 1928reference onto the elements of the list. The @code{my-dolist} call
1929shown here expands to 1929shown here expands to
1930 1930
@@ -2058,7 +2058,7 @@ Lisp, but this package provides @code{defun*} and @code{defmacro*}
2058forms which do create the implicit block. 2058forms which do create the implicit block.
2059 2059
2060The Common Lisp looping constructs defined by this package, 2060The Common Lisp looping constructs defined by this package,
2061such as @code{loop} and @code{dolist}, also create implicit blocks 2061such as @code{loop}, also create implicit blocks
2062just as in Common Lisp. 2062just as in Common Lisp.
2063 2063
2064Because they are implemented in terms of Emacs Lisp @code{catch} 2064Because they are implemented in terms of Emacs Lisp @code{catch}
@@ -2081,7 +2081,7 @@ Otherwise, @code{nil} is returned.
2081 2081
2082@defspec return [result] 2082@defspec return [result]
2083This macro is exactly like @code{(return-from nil @var{result})}. 2083This macro is exactly like @code{(return-from nil @var{result})}.
2084Common Lisp loops like @code{do} and @code{dolist} implicitly enclose 2084Common Lisp loops like @code{do} implicitly enclose
2085themselves in @code{nil} blocks. 2085themselves in @code{nil} blocks.
2086@end defspec 2086@end defspec
2087 2087
@@ -2191,25 +2191,6 @@ Here is another way to write the above loop:
2191@end example 2191@end example
2192@end defspec 2192@end defspec
2193 2193
2194@defspec dolist (var list [result]) forms@dots{}
2195This is a more specialized loop which iterates across the elements
2196of a list. @var{list} should evaluate to a list; the body @var{forms}
2197are executed with @var{var} bound to each element of the list in
2198turn. Finally, the @var{result} form (or @code{nil}) is evaluated
2199with @var{var} bound to @code{nil} to produce the result returned by
2200the loop. The loop is surrounded by an implicit @code{nil} block.
2201@end defspec
2202
2203@defspec dotimes (var count [result]) forms@dots{}
2204This is a more specialized loop which iterates a specified number
2205of times. The body is executed with @var{var} bound to the integers
2206from zero (inclusive) to @var{count} (exclusive), in turn. Then
2207the @code{result} form is evaluated with @var{var} bound to the total
2208number of iterations that were done (i.e., @code{(max 0 @var{count})})
2209to get the return value for the loop form. The loop is surrounded
2210by an implicit @code{nil} block.
2211@end defspec
2212
2213@defspec do-symbols (var [obarray [result]]) forms@dots{} 2194@defspec do-symbols (var [obarray [result]]) forms@dots{}
2214This loop iterates over all interned symbols. If @var{obarray} 2195This loop iterates over all interned symbols. If @var{obarray}
2215is specified and is not @code{nil}, it loops over all symbols in 2196is specified and is not @code{nil}, it loops over all symbols in