Hey guys I am new to clojure. I was just experimenting by printing a pyramid of stars 5 rows and 5 column. Here's the code:
(defn pyramid [j i] (if (and (= i 0) (neg? (println "There's your pyramid")) (if (= j 0) (do (println) (pyramid (- i 1) (- i 1))) (do (print "* ") (pyramid (- j 1) i)))) It's working fine till it prints the pyramid, but after printing it, it continues printing a lot of stars and eventually fail with stack overflow. I am guessing that a if I put a negative check I can prevent it but I wanted to know if there's a way to return from the recursive call instead. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.