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
On Thursday, April 14, 2016 at 5:58:33 PM UTC-7, Varun Kamra wrote:
> 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
calling pyramid recursively, but the compiler
> is able to optimize this recursive call away. In other words, it will
> never overflow the stack.
>
> (defn pyramid [n]
> (when (pos? n)
> (dotimes [_ n]
> (print "* "))
> (println)
> (r
k Brian Marick of Midje
> fame has a similar answer but I can't recall the name.
>
> Oh, and this community is great - keep asking questions and someone
> will answer :-) - are you on slack?
>
> On 15 April 2016 at 03:42, Varun Kamra >
> wrote:
> > Oh, I d