Use (apply base-fun opts)

Luc P.


> I'm trying to define a couple of functions that support the same options, 
> but return different return types.
> 
> I have one function that is the "base" function that provides the most raw 
> access, and some other functions that call this base function and do their 
> thing.
> 
> I would like to make these keyword args available to all of these 
> functions, but I'm unsure how to do this.
> 
> e.g.
> 
> (defn base-fun[& {:keys [num-responses timeout] :or {:num-responses 1 
> :timeout 5000}}]
>   num-responses)
> 
> (defn other-fun[required-arg & opts]
>   (base-fun opts))
> 
> 
> (other-fun "fred" :num-responses 4) ;IllegalArgumentException No value 
> supplied for key: (:num-responses 4) 
> 
> Is there a way to define common keyword args among functions? 
> 
> -- 
> 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.
> 
--
Luc Prefontaine<lprefonta...@softaddicts.ca> sent by ibisMail!

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