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
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]
>
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
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