2010/2/12 Konrad Kułakowski <kulakow...@gmail.com>:
> (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

Regardless of how the code can be restructured -- Michał has a good
proposition here -- I find this exception entirely baffling.
Apparently the first recur -- the one inside the do inside the try
block -- expects no arguments and when amended accordingly to (recur)
will happily proceed to loop infinitely... What gives?

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