docstring of defn is not precise about the `attr-map?` and `body` arguments

Description

The docstring for defn is:

Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata. prepost-map defines a map with optional keys re and ost that contain collections of pre or post conditions.

The arglist is:

(defn name doc-string? attr-map? [params*] prepost-map? body)

There are two issues that made this docstring hard to understand for me:

1. The docstring does not mention attr-map? - it took me a a bit of jumping around the docs to make the leap from attr-map? to "with any [...] attrs added to the var metadata".
2. The docstring makes reference to exprs*, but the arglist refers to body.

Environment

None

Activity

Show:
Alex Miller
July 28, 2017, 2:24 PM

Patch welcome, would appreciate smallest change possible.

Marc O'Morain
August 19, 2017, 9:24 PM

I've attached a patch to address two issues:

  • change 'exprs*' to 'body' to match the arglist.

  • change 'body+)' to 'body)+' when referring to the multi-artiy form.

I didn't address "any attrs" referring to attr-map, I wasn't sure the most "Clojury" way to phrase it.

Alex Miller
August 20, 2017, 10:59 PM

Seems like the body change is missing a trailing right paren?

You have: (def name (fn ([params* ] body)+)
Should be: (def name (fn ([params* ] body)+))

import
January 23, 2018, 3:38 PM

Hi @marc, any updates? It would be lovely to get this in Thanks!

Assignee

Unassigned

Reporter

Marc O'Morain

Labels

Approval

Triaged

Patch

None

Affects versions

Priority

Minor
Configure