Re: Help me make this fn better/prettier

2014-10-01 Thread James Reeves
You could write it: (defn say-hello ([names] (say-hello names #{})) ([[name & names] saluted] (if name (do (if (saluted name) (println "Welcome back" name) (println "Hello" name)) (recur names (conj saluted name))) (println "Goodbye" - Jam

Re: Help me make this fn better/prettier

2014-10-01 Thread john walker
Sorry, the if should be if-not. The gist is corrected. On Wednesday, October 1, 2014 5:20:28 PM UTC-7, john walker wrote: > > Hi! > > Here's another way you could do it: > > (defn say-hello > ([names] (say-hello names #{})) > ([names saluted] > (reduce (fn [saluted name] >

Re: Help me make this fn better/prettier

2014-10-01 Thread john walker
Hi! Here's another way you could do it: (defn say-hello ([names] (say-hello names #{})) ([names saluted] (reduce (fn [saluted name] (if (saluted name) (do (println "Hello" name "!") (conj saluted name)) (do (println "W

Help me make this fn better/prettier

2014-10-01 Thread Nicolás F .
I'm a clojure noob and im playing around with the language; made this fn to have a taste of a couple of features. I think it's pretty concise but i'm probably doing something "not the clojure way", So if you can teach me a couple of things please go ahead ;D (defn say_hello ([names] (say_he