On 13 March 2010 15:49, Glen Rubin <rubing...@gmail.com> wrote:
> If I try:
>
> (filter #(while (< % 20)) primes)
>
> It gets hung up since filter keeps testing primes, despite the fact
> that they have grown too large.  So, I would like filter to stop at
> the first false result.

Actually that's not what happens. Execution never leaves the first
application of #(while (< % 20)), since it expands (performing
macro-expansion and substituting the concrete parameter for the formal
%) to

(loop []
  (when (< 2 20)
    (recur)))

See the docs on while (e.g. through (doc while) at the REPL) and its
source (e.g. through (c.c.repl-utils/source while) at the REPL).

Sincerely,
Michał

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to