Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
asdf
asdf
Commits
a923121f
Commit
a923121f
authored
Jun 08, 2010
by
Robert P. Goldman
Browse files
Docstring for WHILE-COLLECTING.
parent
58f7b0d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
asdf.lisp
View file @
a923121f
...
...
@@ -467,6 +467,16 @@ processed in order by OPERATE."))
;;;; General Purpose Utilities
(
defmacro
while-collecting
((
&rest
collectors
)
&body
body
)
"COLLECTORS should be a list of names for collections. A collector
defines a function that, when applied to an argument inside BODY, will
add its argument to the corresponding collection. Returns multiple values,
a list for each collection, in order.
E.g.,
\(while-collecting \(foo bar\)
\(dolist \(x '\(\(a 1\) \(b 2\) \(c 3\)\)\)
\(foo \(first x\)\)
\(bar \(second x\)\)\)\)
Returns two values: \(A B C\) and \(1 2 3\)."
(
let
((
vars
(
mapcar
#'
(
lambda
(
x
)
(
gensym
(
symbol-name
x
)))
collectors
))
(
initial-values
(
mapcar
(
constantly
nil
)
collectors
)))
`
(
let
,
(
mapcar
#'
list
vars
initial-values
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment