Why is there no non-zero? in Clojure?
2 answers
In Clojure, false and nil are false (treated as "false"), everything else is true (treated as "true").
As an example,
(if-not nil
true
false)
is true and
(if-not false
true
false)
also evaluates to true. In most cases, you shouldn't explicitly check for null, but rather use forms that work with false / rights values.
If you only have to check for null, you can use some?
derivatives as well.
+1
source to share