On Fri, Oct 29, 2010 at 7:14 AM, Meikel Brandmeyer <m...@kotka.de> wrote:
>
> There's nothing stoping you to put a let in a loop.
>
> (loop [ps  (seq pairs)
>       ret {}]
>  (let [ffps (ffirst ps)]
>    (cond
>      (not ps)         ret
>      (some-test ffps) (recur (next ps) (add-to-result ret ffps))
>      :else            (recur (next ps) (do-sth-else ret ffps)))))

This is totally true! Scheme has been my primary Lisp since coming to
clojure, and scheme would blow up when doing (first (first ps)) [a.k.a
(ffirst ps)] so I never remember that it'll just return nil instead of
blowing up (thus the reason for the (if (empty? ..)) being hoisted in
my suggested code).


-- 
http://www.apgwoz.com

-- 
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