I'm confused. Shouldn't the inner loop have the proper conditionals to break out of itself properly instead?
On Jan 18, 8:48 am, Alex Ott <alex...@gmail.com> wrote: > Re > > Konrad Hinsen at "Mon, 18 Jan 2010 12:23:58 +0100" wrote: > KH> On 18.01.2010, at 12:03, Alex Ott wrote: > > >> I have a question to Rich - are there plans to introduce "named" > >> loop/recur? In Scheme it very handy to create named let, and create > nested > >> loops. Currently in Clojure, I need to split nested loop into separate > >> function, that not so often good > > KH> Nested loops work perfectly fine in Clojure: > > But this will not allow to jump to outer loop from inside of inner loop... > > KH> (defn print-pairs [seq1 seq2] > KH> (loop [s1 seq1] > KH> (when (seq s1) > KH> (loop [s2 seq2] > KH> (when (seq s2) > KH> (prn (first s1) (first s2)) > KH> (recur (rest s2)))) > KH> (recur (rest s1))))) > > KH> (print-pairs [1 2] ["a" "b"]) > > -- > With best wishes, Alex Ott, MBAhttp://alexott.blogspot.com/ > http://xtalk.msk.su/~ott/http://alexott-ru.blogspot.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