2010/2/12 Konrad Kułakowski <kulakow...@gmail.com>: > I have a piece of code like this: > > (def ll ['a 'b 'c 'd]) > > (loop [e (first ll) f (rest ll)] > (do > (try > (do > (println e) ;; do sth with e which may throw an exception > (recur (first f) (rest f))) > (catch Exception _ (println "ex"))) > (println "something") > (recur (first ll) f (rest ll)) > )) > > > as a result I've got a message: > java.lang.IllegalArgumentException: Mismatched argument count to > recur, expected: 0 args, got: 2 > > So, my question is how to catch exception and do something with them > and keep looping?
You're clearly doing something for side effects, so why not use doseq instead? (def alist ['a 'b 'c 'd]) (doseq [e alist] (try (println e) ;; may throw exception here (catch Exception _ (println "ex")))) Cheers, mk -- 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