phillip.l...@newcastle.ac.uk (Phillip Lord) writes:

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

Well, that's nothing special wrt. higher-order functions, but a
limitation when you define functions with `def`.  E.g.,

  (def my-function (fn [x y]))

doesn't have :arglists metadata, too.

But since you have to add the docstring by hand anyway, I don't think
that's much of an issue:

  (def ^{:doc "Applies my-function to 10 and y."
         :arglists '([y])}
       my-partial-function (partial my-function 10))

Bye,
Tassilo

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