not-empty

added
1.0

ns
clojure.core

type
function

(not-empty coll)

If coll is empty, returns nil, else coll

                user=> (not-empty [1])
[1]
user=> (not-empty [1 3 5])
[1 3 5]
user=> (not-empty [])
nil
user=> (not-empty '())
nil
user=> (not-empty {})
nil
user=> (not-empty nil)
nil
            
                ;; Same behaviour for strings

user> (not-empty "hello")
"hello"

user> (not-empty "")
nil