clojure macro if-empty?
I have written a if-pred? macro as follows

    (defmacro if-pred?
      ([pred lst then] `(if (~pred ~lst) ~then nil))
      ([pred lst then else] `(if (~pred ~lst) ~then ~else)))

Now I want to construct a if-empty? macro from that.


    (defmacro if-empty? [lst then & else] 
      (if-pred? empty? lst then else))

I want to use if-empty? like:

    (if-empty? '()
    	   (println "empty")
    	   (println "not-empty"))


But apparently if-empty? is not working. When I run the above code **not-empty** gets printed immaterial of whether the list I pass to if-empty? is really empty or not. After printing  **not-empty** java.lang.NullPointerException is thrown.
clojure macro if-empty?
===

I have written a if-pred? macro as follows

    (defmacro if-pred?
      ([pred lst then] `(if (~pred ~lst) ~then nil))
      ([pred lst then else] `(if (~pred ~lst) ~then ~else)))

Now I want to construct a if-empty? macro from that.


    (defmacro if-empty? [lst then & else] 
      (if-pred? empty? lst then else))

I want to use if-empty? like:

    (if-empty? '()
    	   (println "empty")
    	   (println "not-empty"))


But apparently if-empty? is not working. When I run the above code **not-empty** gets printed immaterial of whether the list I pass to if-empty? is really empty or not. After printing  **not-empty** java.lang.NullPointerException is thrown.