On 18 Jan 2010, at 11:23, Konrad Hinsen <konrad.hin...@fastmail.net> wrote:

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

Nested loops work perfectly fine in Clojure:


Is this a recursive email? After receiving it seven times I've blown my stack.

(defn print-pairs [seq1 seq2]
 (loop [s1 seq1]
   (when (seq s1)
     (loop [s2 seq2]
   (when (seq s2)
     (prn (first s1) (first s2))
     (recur (rest s2))))
     (recur (rest s1)))))

(print-pairs [1 2] ["a" "b"])


I am not claiming that this is a good way to find pairs of items, but it's an illustration for nested loops... recur always refers to the innermost loop, so it can be nested to any level.

Konrad.

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