Re: Returning early from a function

2015-02-22 Thread Stig Brautaset
Hi, I see you use the multi-arity form of * - did you know that you can use that with < and <= too? I think it this improves your function: (defn params-correct-lucky-numbers [upto] (let [max (* 10 1000 1000)] (if (<= 1 upto max) true (do (println "The parameter

Re: Returning early from a function

2015-02-20 Thread Cedric Roussel
You may want to look at https://clojuredocs.org/clojure.core/case https://clojuredocs.org/clojure.core/cond On Friday, February 20, 2015 at 11:01:43 AM UTC+1, Cecil Westerhof wrote: > > I have a function to check the parameters of another function: > (defn params-correct-lucky-numbers >

Re: Returning early from a function

2015-02-20 Thread Cecil Westerhof
Answering my own question. :-D 2015-02-20 11:01 GMT+01:00 Cecil Westerhof : > I have a function to check the parameters of another function: > (defn params-correct-lucky-numbers > [upto] > (let [max (* 10 1000 1000)] > (if (< upto 1) > (do > (pr

Returning early from a function

2015-02-20 Thread Cecil Westerhof
I have a function to check the parameters of another function: (defn params-correct-lucky-numbers [upto] (let [max (* 10 1000 1000)] (if (< upto 1) (do (println "The parameter upto should at least be 1") false) (if (> upt