2
;;;; Author: Paul Dietz
3
;;;; Created: Thu Nov 21 09:46:27 2002
4
;;;; Contains: Tests that uninterned symbols can be loop keywords
10
(loop #:for i #:from 1 #:to 10 #:collect i)
11
(1 2 3 4 5 6 7 8 9 10))
14
(loop #:for i #:upfrom 1 #:below 10 #:by 2 #:collect i)
18
(loop #:with x = 1 #:and y = 2 #:return (values x y))
22
(loop #:named foo #:doing (return-from foo 1))
28
#:initially (setq x 2)
30
#:finally (return x)))
34
(loop #:for x #:in '(a b c) #:collecting x)
38
(loop #:for x #:in '(a b c) #:append (list x))
42
(loop #:for x #:in '(a b c) #:appending (list x))
46
(loop #:for x #:in '(a b c) #:nconc (list x))
50
(loop #:for x #:in '(a b c) #:nconcing (list x))
54
(loop #:for x #:in '(1 2 3) #:count x)
58
(loop #:for x #:in '(1 2 3) #:counting x)
62
(loop #:for x #:in '(1 2 3) #:sum x)
66
(loop #:for x #:in '(1 2 3) #:summing x)
70
(loop #:for x #:in '(10 20 30) #:maximize x)
74
(loop #:for x #:in '(10 20 30) #:maximizing x)
78
(loop #:for x #:in '(10 20 30) #:minimize x)
82
(loop #:for x #:in '(10 20 30) #:minimizing x)
86
(loop #:for x #:in '(1 2 3 4) #:sum x #:into foo #:of-type fixnum
87
#:finally (return foo))
91
(loop #:for x #:upfrom 1 #:to 10
92
#:if (evenp x) #:sum x #:into foo
93
#:else #:sum x #:into bar
95
#:finally (return (values foo bar)))
99
(loop #:for x #:downfrom 10 #:above 0
100
#:when (evenp x) #:sum x #:into foo
101
#:else #:sum x #:into bar
103
#:finally (return (values foo bar)))
107
(loop #:for x #:in '(a b nil c d nil)
108
#:unless x #:count t)
112
(loop #:for x #:in '(a b nil c d nil)
113
#:unless x #:collect x #:into bar #:and #:count t #:into foo
115
finally (return (values bar foo)))
120
(loop #:for x #:in '(nil nil a b nil c nil)
126
(loop #:for x #:in '(a b nil c nil)
127
#:while x #:collect x)
131
(loop #:for x #:in '(nil nil a b nil c nil)
136
(loop #:for x #:in '(nil nil a b nil c nil)
141
(loop #:for x #:in '(a b c d e)
146
(loop #:as x #:in '(a b c) #:count t)
150
(loop #:for i #:from 10 #:downto 5 #:collect i)
154
(loop #:for i #:from 0 #:upto 5 #:collect i)
158
(loop #:for x #:on '(a b c) #:collecting (car x))
162
(loop #:for x = '(a b c) #:then (cdr x)
168
(loop #:for x #:across #(a b c) #:collect x)
172
(loop #:for x #:being #:the #:hash-keys #:of (make-hash-table)
177
(loop #:for x #:being #:each #:hash-key #:in (make-hash-table)
182
(loop #:for x #:being #:each #:hash-value #:of (make-hash-table)
187
(loop #:for x #:being #:the #:hash-values #:in (make-hash-table)
192
(loop #:for x #:being #:the #:hash-values #:in (make-hash-table)
193
#:using (#:hash-key k)
198
(loop #:for x #:being #:the #:hash-keys #:in (make-hash-table)
199
#:using (#:hash-value v)
205
(ignore-errors (delete-package "LOOP.16.PACKAGE"))
206
(let ((p (make-package "LOOP.16.PACKAGE" :use nil)))
207
(loop #:for x #:being #:the #:symbols #:of p #:count t)))
212
(ignore-errors (delete-package "LOOP.16.PACKAGE"))
213
(let ((p (make-package "LOOP.16.PACKAGE" :use nil)))
214
(loop #:for x #:being #:each #:symbol #:of p #:count t)))
219
(ignore-errors (delete-package "LOOP.16.PACKAGE"))
220
(let ((p (make-package "LOOP.16.PACKAGE" :use nil)))
221
(loop #:for x #:being #:the #:external-symbols #:of p #:count t)))
226
(ignore-errors (delete-package "LOOP.16.PACKAGE"))
227
(let ((p (make-package "LOOP.16.PACKAGE" :use nil)))
228
(loop #:for x #:being #:each #:external-symbol #:of p #:count t)))
233
(ignore-errors (delete-package "LOOP.16.PACKAGE"))
234
(let ((p (make-package "LOOP.16.PACKAGE" :use nil)))
235
(loop #:for x #:being #:the #:present-symbols #:of p #:count t)))
240
(ignore-errors (delete-package "LOOP.16.PACKAGE"))
241
(let ((p (make-package "LOOP.16.PACKAGE" :use nil)))
242
(loop #:for x #:being #:each #:present-symbol #:of p #:count t)))