From f02e0447192db7be3de79ed8167c3ae4c0658206 Mon Sep 17 00:00:00 2001 From: pyos Date: Tue, 29 Apr 2014 18:04:21 +0400 Subject: [PATCH] Move the documentation for `zipwith` to the correct place. --- docs/language/api.rst | 22 ---------------------- docs/language/core.rst | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/docs/language/api.rst b/docs/language/api.rst index fe3575e..e58db48 100644 --- a/docs/language/api.rst +++ b/docs/language/api.rst @@ -1273,25 +1273,3 @@ yield-from want your coroutine to be able to delegate its processes to another coroutine, say if using something fancy like `asyncio `_. - - -.. _zipwith: - -zipwith -------- - -.. versionadded:: 0.10.0 - -`zipwith` zips multiple lists and maps the given function over the result. It is -equilavent to calling ``zip``, followed by calling ``map`` on the result. - -In the following example, `zipwith` is used to add the contents of two lists -together. The equilavent ``map`` and ``zip`` calls follow. - -.. code-block:: clj - - => (import operator.add) - => (zipwith operator.add [1 2 3] [4 5 6]) ; using zipwith - [5, 7, 9] - => (map operator.add (zip [1 2 3] [4 5 6])) ; using map+zip - [5, 7, 9] diff --git a/docs/language/core.rst b/docs/language/core.rst index f52338d..42070cf 100644 --- a/docs/language/core.rst +++ b/docs/language/core.rst @@ -983,3 +983,21 @@ Return an iterator from ``coll`` as long as predicate, ``pred`` returns True. => (list (take-while neg? [ 1 2 3 -4 5])) [] + +.. _zipwith: + +zipwith +------- + +.. versionadded:: 0.9.13 + +Usage: ``(zipwith fn coll ...)`` + +Equivalent to ``zip``, but uses a multi-argument function instead of creating a tuple. +If ``zipwith`` is called with N collections, then ``fn`` must accept N arguments. + +.. code-block:: clojure + + => (import operator) + => (list (zipwith operator.add [1 2 3] [4 5 6])) + [5, 7, 9]