Tassilo Horn <[email protected]> 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]))
Yes, of course. But I have defn to use an option in this case.
> 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))
Sure this is what I have been doing. But when the arglist is more
complex it is a pain and results in a lot of duplication.
Phil
--
--
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.