On Jan 30, 1:26 am, Robert McIntyre <r...@mit.edu> wrote:
> you could do something like this, but I'm curious --- why do you want
> to restrict the function's inputs in this way?

As they are optional arguments, it's possible that somebody might
misspell a key and spend time debugging. The intention is to avoid
that.

>
> (defn hello [& {:keys [a b] :as input}]
> (assert (= (set (keys input)) #{:a :b}))
>  "hello")

Thanks, I realized I need something like the following:

(defn hello
  [& {:keys [a b] :as input}]
  (doseq [each (keys input)]
    (assert (contains? #{:a :b} each)))
  "hello")

Regards,
Shantanu

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