[iterate-devel] thereis vs. collect ?
Chris Dean
ctdean at sokitomi.com
Wed May 31 04:24:49 UTC 2006
I'm getting an error when using thereis and collect in the same iterate:
(iter (for x :in '(3 1 4 1 5 9))
(thereis (evenp x))
(collect x)))
gives
Attempt to do COLLECT accumulation into a variable already being
used for IF-EXISTS accumulation.
I don't really understand how these variables in collect, thereis, etc
are chosen, maybe soemone could enlighten me.
I can rewrite it to bypass thereis:
(iter (for x :in '(3 1 4 1 5 9))
(let ((result (evenp x)))
(when result
(leave result)))
(collect x)))
or use my own accumulation variable:
(iter (for x :in '(3 1 4 1 5 9))
(thereis x)
(collect x :into y)))
but I prefer not to do either of those. Far too much typing!
Cheers,
Chris Dean
More information about the iterate-devel
mailing list