Is there any function in clojure which calculates the boolean value of the given expression? What I mean is if expression is nil or false then this function returns false, otherwise true?
(to-bool nil) ; => false
(to-bool false) ; => false
(to-bool java.util.Date.) ; => true
(to-bool true) ; => true
(to-bool 7) ; => true
Something like that?
boolean it is.
(boolean nil) ; => false
(boolean false) ; => false (I assume you expect false, not true here!)
(boolean (java.util.Date.)) ; => true
(boolean true) ; => true
(boolean 7) ; => true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With