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

Attachments

1

Activity

Show:

import January 23, 2018 at 3:38 PM

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

Alex Miller August 20, 2017 at 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)+))

Marc O'Morain August 19, 2017 at 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 July 28, 2017 at 2:24 PM

Patch welcome, would appreciate smallest change possible.

Details

Assignee

Reporter

Labels

Approval

Triaged

Priority

Affects versions

Created July 28, 2017 at 2:21 PM
Updated May 18, 2019 at 1:52 PM