Thanks Adrian et al.
I am going to remove recur from try catch special form. (BTW: doseq is
not the case since I need to modify freely the collection during
looping)
On the other hand I am curios whether no recur inside the try-catch
special form might be adopted as a rule of thumb. It is
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
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
Here's an idiomatic way of doing what you want;
(defn lp [col]
(loop [ll (seq col)]
(when ll
(try
(let [itm (first ll)]
(if (= itm 'x) (throw (IllegalArgumentException.
(str itm not supported.)))
(println (str done item: itm