Rich & rest. I have gone through the process of implementing this in defn. The patch is inlined for commenting (if need be) and attached for accurate application.
I declare my changes public domain, but I suppose I could fill out a
CA if it helps. I can also make a similar change for defmacro, if you
want.
But if you don't want this at all, then I'll go weep in a corner and
leave it at that.
$ svn diff
Index: src/clj/clojure/core.clj
===================================================================
--- src/clj/clojure/core.clj (revision 1188)
+++ src/clj/clojure/core.clj (working copy)
@@ -183,6 +183,7 @@
name (fn ([params* ] exprs*)+)) with any doc-string or attrs added
to the var metadata"
:arglists '([name doc-string? attr-map? [params*] body]
+ [name attr-map? [params*] doc-string body]
[name doc-string? attr-map? ([params*] body)+ attr-map?])}
defn (fn defn [name & fdecl]
(let [m (if (string? (first fdecl))
@@ -197,6 +198,13 @@
fdecl (if (map? (first fdecl))
(rest fdecl)
fdecl)
+ m (if (clojure.lang.Numbers/lt 2 (clojure.lang.RT/length fdecl))
+ (if (vector? (first fdecl))
+ (if (string? (second fdecl))
+ (if (m :doc) m (assoc m :doc (second fdecl)))
+ m)
+ m)
+ m)
fdecl (if (vector? (first fdecl))
(list fdecl)
fdecl)
On Fri, Dec 19, 2008 at 1:06 PM, Christian Vest Hansen
<[email protected]> wrote:
> On Fri, Dec 19, 2008 at 12:46 PM, Michael Wood <[email protected]> wrote:
>>
>> Where would it go when you have multiple parameter lists and bodies?
>>
>> (defn blah ([a] (do-something-with a)) ([a b] (do-something-with a b)))
>
> That case should be unchanged, and work as it does today.
>
>>
>> --
>> Michael Wood <[email protected]>
>>
>> >>
>>
>
>
>
> --
> Venlig hilsen / Kind regards,
> Christian Vest Hansen.
>
--
Venlig hilsen / Kind regards,
Christian Vest Hansen.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---
doc-string.patch
Description: Binary data
