fix to assoc docs + new multiassoc definition

This commit is contained in:
Guillermo Vaya 2013-07-17 16:25:22 +02:00
parent a71e09b1cf
commit 82e8598cd6

View File

@ -94,18 +94,24 @@ assoc
-----
`assoc` form is used to associate a key with a value in a dictionary or to set
an index of a list to a value. It takes three parameters: `datastructure` to be
modified, `key` or `index` and `value`.
an index of a list to a value. It takes at least three parameters: `datastructure`
to be modified, `key` or `index` and `value`. If more than three parameters are
used it will associate in pairs.
Examples of usage:
.. code-block:: clj
=>(let [[collection ({})]]
=>(let [[collection {}]]
... (assoc collection "Dog" "Bark")
... (print collection))
{u'Dog': u'Bark'}
=>(let [[collection {}]]
... (assoc collection "Dog" "Bark" "Cat" "Meow")
... (print collection))
{u'Cat': u'Meow', u'Dog': u'Bark'}
=>(let [[collection [1 2 3 4]]]
... (assoc collection 2 None)
... (print collection))