Actually this is possible. (see http://xkcd.com/386/)

See the macro add-arity which I've put up here: http://gist.github.com/273349

This allows you to do things like:

user> (add-arity keyword [ns name suffix] (keyword ns (str name "-"
suffix)))
#<user$eval__6304$fn__6309 user$eval__6304$fn__6...@5d8e63>

user> (keyword nil "hello" "more")
:hello-more

The code I put up will handle (I think) all sorts of variations of arg
counts: you can use add-arity just like defn and it will grab any
specified arglists (including arglists with &) and proxy the others
back to the original function. It doesn't do anything with metadata,
though. Also, you can override a given arity on the original function,
but you can't then call the original version at that arity.

Whether this is a good idea or not is a completely different
question :-)


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