(defn hello
"Writes hello message to *out*. Calls you by username.
Knows if you have been here before."
[username]
(dosync
(let [past-visitor (@visitors username)]
(if past-visitor
(str "Welcome back, " username)
(do
(alter visitors conj username)
(str "Hello, " username) ) ) ) ) )
The code is copied from book "Programming Clojure", I think the ) is
too much for reading. So, can we using the following style:
defn hello [username]
dosync
let [past-visitor (@visitors username)]
if past-visitor
str "welcome back, " username
do
alter visitors conj username
str "Hello, " username
The line indent contains the parenthesis and it looks it is much
friendly for ready.
I think clojure may mix both the parenthese and python-like indent
together.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---