Re: Return from a function

2016-04-17 Thread Varun Kamra
Thanks for the links. No, I am not on slack. On Friday, April 15, 2016 at 12:24:23 AM UTC-7, Colin Yates wrote: > > Hi Varun - the best advice I think I could give you is to spend a > whole bunch of time on https://clojuredocs.org and https://www.conj.io > (any others?) familiarising yourself wi

Re: Return from a function

2016-04-17 Thread Brian Marick
Colin Yates wrote: Also, you might want to invest in either core.typed or prismatic schema for validating shapes of data. I think Brian Marick of Midje fame has a similar answer but I can't recall the name. https://github.com/marick/structural-typing/ -- You received this message because you

Re: Return from a function

2016-04-15 Thread Colin Yates
Hi Varun - the best advice I think I could give you is to spend a whole bunch of time on https://clojuredocs.org and https://www.conj.io (any others?) familiarising yourself with the core API. There is also the official http://clojure.org/api/api but I find the example on clojuredocs invaluable. F

Re: Return from a function

2016-04-14 Thread Varun Kamra
Oh, I didn't even know we could loop using dotimes. Thanks for the explanation and for the code as well. On Thursday, April 14, 2016 at 6:58:57 PM UTC-7, Bobby Eickhoff wrote: > > The result of the last expression evaluated is always returned. Hence, > the shape of the function is what determin

Re: Return from a function

2016-04-14 Thread Bobby Eickhoff
The result of the last expression evaluated is always returned. Hence, the shape of the function is what determines the points of return and the returned values. For example, if you're entire function is defined as one (if ...) statement, there are two possible points of return, each of the

Re: Return from a function

2016-04-14 Thread Varun Kamra
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's your pyramid")) > (if (= j 0) >

Return from a function

2016-04-14 Thread Varun Kamra
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