Hey, I developed a macro called defnks.

I wrote a blogpost about it here:

http://resatori.com/advanced-keyword-function

You can look at the code here:

https://gist.github.com/999256

---

It works like clojure.contrib.def/defnk but also asserting obligatory
& optional keys and being able to input keys without default values.

I would appreciate a code review :)

Here is an example what it extends to:

(defnks mytest
  [:obligatorya :obligatoryb
   :opt :c :d :e
   :opt-def :name "noname"]
  [obligatorya obligatoryb c d e name])

(clojure.core/defn mytest
 [&
  {:or {name "noname"},
   :as m,
   :keys [obligatorya obligatoryb c d e name]}]
 {:pre
  [(game.utils.core/contains-keys? m [:obligatorya :obligatoryb])
   (clojure.core/every?
    (fn*
     [p1__433__434__auto__]
     (clojure.core/some
      #{p1__433__434__auto__}
      [:obligatorya :obligatoryb :c :d :e :name]))
    (clojure.core/keys m))]}
 [obligatorya obligatoryb c d e name])

-- 
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

Reply via email to