Document function docstrings
This commit is contained in:
parent
9859b0085c
commit
e05af9d7e0
@ -449,13 +449,16 @@ below:
|
|||||||
defn
|
defn
|
||||||
----
|
----
|
||||||
|
|
||||||
``defn`` macro is used to define functions. It takes three
|
``defn`` is used to define functions. It requires two arguments: a name (given
|
||||||
parameters: the *name* of the function to define, a vector of *parameters*,
|
as a symbol) and a list of parameters (also given as symbols). Any remaining
|
||||||
and the *body* of the function:
|
arguments constitute the body of the function.
|
||||||
|
|
||||||
.. code-block:: clj
|
.. code-block:: clj
|
||||||
|
|
||||||
(defn name [params] body)
|
(defn name [params] bodyform1 bodyform2...)
|
||||||
|
|
||||||
|
If there at least two body forms, and the first of them is a string literal,
|
||||||
|
this string becomes the :ref:`docstring <py:docstring>` of the function.
|
||||||
|
|
||||||
Parameters may be prefixed with the following special symbols. If you use more
|
Parameters may be prefixed with the following special symbols. If you use more
|
||||||
than one, they can only appear in the given order (so all `&optional`
|
than one, they can only appear in the given order (so all `&optional`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user