Move the documentation for zipwith
to the correct place.
This commit is contained in:
parent
8e4b21103c
commit
f02e044719
@ -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 <http://docs.python.org/3.4/library/asyncio.html>`_.
|
||||
|
||||
|
||||
.. _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]
|
||||
|
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user