On Fri, Dec 27, 2013 at 3:13 PM, john walker <[email protected]>wrote:
> This works (clever hack!), but you would have to reduplicate the keys in
> (defn bar [..]...), (defn baz [...] ...) etc.
>
(defmacro defthingyfn [name arglist & body]
`(defn name ~(vec (cons '{:keys [thingy mumble fiddly]} arglist)) ~@body))
(defthingyfn foo [x]
(...thingy ... mumble ... fiddly ... mumble ... mumble ... x ... thingy
...))
(defthingyfn bar [x]
(...mumble ... thingy ... mumble ... mumble ... x ... thingy ... fiddly
... thingy ...))
...
(Extending that to cope with docstrings and multiple arities is left as an
exercise for the reader. :))
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.