I am trying to get a couple of edge cases to past and since I am very new 
to clojure/lisp (2 days total) I thought I would ask.


I am using defmacro like the following. I have 2 edge case which are 
failing. I would like to be able to process these cases where there are 
extra bits and as you probably guessed the last 2 entries have keys with 
not value. I don't thinks the :keys will work for these cases.

Any ideas on how I could destruct this so all the cases would pass?

(defmacro iif [expr & {:keys [then, else]}] 
`(if ~expr ~then ~else))

(println(iif (> 3 1))) ;nil
(println(iif (> 3 1) :then 'ok)) ;ok
(println(iif (< 5 3) :else 'ok)) ;ok
(println(iif (> 3 1) :else 'oops)) ;nil

(println(iif (> 3 1) :else 'oops :then 'ok));ok
;;(println(iif (> 3 1) :then )) ;nil
;;(println(multi-if (> 3 1) :else 'oops :then (println'hi) 'ok)) ;;hi ok

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to