I've been refactoring some code recently, part of which has include the
introduction of higher-order function. But this is causing me some
grief in terms of extra work. Let me give an example:

user> (defn my-function [x y])
#'user/my-function
user> (doc my-function)
-------------------------
user/my-function
([x y])
  nil
nil
user> (def my-partial-function (partial my-function 10))
#'user/my-partial-function
user> (doc my-partial-function)
-------------------------
user/my-partial-function
  nil
nil

The problem is that documentation for my-partial-function doesn't
include an arglist. Now I can add this in my hand, but that's a pain. 

I could write a macro which created a new `defx' form. This could use
the higher order function, calculating the metadata from the function
argument. And, indeed, I have done this. But it's a pain also if I want
to replicate the defn functionality (i.e. pre/post conditions, a doc
string and so on), because the macro gets quite complex. 

As far as I can see, this leaves me with the option creating a macro,
say `defdef' which creates new macros of the form `defx'. Which is
something that I would like to avoid writing if possible. 

Am I missing something simple?

Phil


-- 
-- 
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/groups/opt_out.


Reply via email to