From 82e8598cd6986e3d2d282ce29fa6c5557a64b0de Mon Sep 17 00:00:00 2001 From: Guillermo Vaya Date: Wed, 17 Jul 2013 16:25:22 +0200 Subject: [PATCH] fix to assoc docs + new multiassoc definition --- docs/language/api.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/language/api.rst b/docs/language/api.rst index c1235a7..09545e4 100644 --- a/docs/language/api.rst +++ b/docs/language/api.rst @@ -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))