From a comment on another question, someone is saying that Clojure idiom prefers to return nil rather than an empty list like in Scheme. Why is that?
Like,
Since I wrote the comment I will write a answer. (The answer of skuro provides all information but maybe a too much)
seq
is just what everybody uses most of the time but empty?
is fine to its just (not (seq lat))
when
has only one branch this is spezially good if you want to have sideeffects. You don't have to use do
.See this example:
(if false '() (do (println 1) (println 2) (println 3)))
you can write
(when true (println 1) (println 2) (println 3))
Not that diffrent but i think its better to read.
P.S.
Not that there are functions called if-not
and when-not
they are often better then (if (not true) ...)