diff --git a/doc/helpdb.jl b/doc/helpdb.jl index acf4c899622bd..ad81082c7acca 100644 --- a/doc/helpdb.jl +++ b/doc/helpdb.jl @@ -696,6 +696,14 @@ "), +("Iterable Collections","Base","eltype","eltype(collection) + + Determine the type of the elements generated by iterating + \"collection\". For associative collections, this will be a + \"(key,value)\" tuple type. + +"), + ("Iterable Collections","Base","indexin","indexin(a, b) Returns a vector containing the highest index in \"b\" for each @@ -724,8 +732,8 @@ Reduce the given collection with the given operator, i.e. accumulate \"v = op(v,elt)\" for each element, where \"v\" starts as \"v0\". Reductions for certain commonly-used operators are - available in a more convenient 1-argument form: \"max(itr)\", - \"min(itr)\", \"sum(itr)\", \"prod(itr)\", \"any(itr)\", + available in a more convenient 1-argument form: \"maximum(itr)\", + \"minimum(itr)\", \"sum(itr)\", \"prod(itr)\", \"any(itr)\", \"all(itr)\". The associativity of the reduction is implementation-dependent; if @@ -928,6 +936,22 @@ "), +("Iterable Collections","Base","filter","filter(function, collection) + + Return a copy of \"collection\", removing elements for which + \"function\" is false. For associative collections, the function is + passed two arguments (key and value). + +"), + +("Iterable Collections","Base","filter!","filter!(function, collection) + + Update \"collection\", removing elements for which \"function\" is + false. For associative collections, the function is passed two + arguments (key and value). + +"), + ("Indexable Collections","Base","getindex","getindex(collection, key...) Retrieve the value(s) stored at the given key or index within a @@ -1014,27 +1038,6 @@ "), -("Associative Collections","Base","filter","filter(function, collection) - - Return a copy of collection, removing (key, value) pairs for which - function is false. - -"), - -("Associative Collections","Base","filter!","filter!(function, collection) - - Update collection, removing (key, value) pairs for which function - is false. - -"), - -("Associative Collections","Base","eltype","eltype(collection) - - Returns the type tuple of the (key,value) pairs contained in - collection. - -"), - ("Associative Collections","Base","sizehint","sizehint(s, n) Suggest that collection \"s\" reserve capacity for at least \"n\" @@ -4869,12 +4872,6 @@ popdisplay(d::Display) "), -("Arrays","Base","eltype","eltype(A) - - Returns the type of the elements contained in A - -"), - ("Arrays","Base","iseltype","iseltype(A, T) Tests whether A or its elements are of type T diff --git a/doc/stdlib/base.rst b/doc/stdlib/base.rst index d62ced0e64d89..ea28879f9c3a0 100644 --- a/doc/stdlib/base.rst +++ b/doc/stdlib/base.rst @@ -445,7 +445,12 @@ Iterable Collections Determine whether an item is in the given collection, in the sense that it is ``isequal`` to one of the values generated by iterating over the collection. - + +.. function:: eltype(collection) + + Determine the type of the elements generated by iterating ``collection``. + For associative collections, this will be a ``(key,value)`` tuple type. + .. function:: indexin(a, b) Returns a vector containing the highest index in ``b`` @@ -463,7 +468,7 @@ Iterable Collections .. function:: reduce(op, v0, itr) - Reduce the given collection with the given operator, i.e. accumulate ``v = op(v,elt)`` for each element, where ``v`` starts as ``v0``. Reductions for certain commonly-used operators are available in a more convenient 1-argument form: ``max(itr)``, ``min(itr)``, ``sum(itr)``, ``prod(itr)``, ``any(itr)``, ``all(itr)``. + Reduce the given collection with the given operator, i.e. accumulate ``v = op(v,elt)`` for each element, where ``v`` starts as ``v0``. Reductions for certain commonly-used operators are available in a more convenient 1-argument form: ``maximum(itr)``, ``minimum(itr)``, ``sum(itr)``, ``prod(itr)``, ``any(itr)``, ``all(itr)``. The associativity of the reduction is implementation-dependent; if you need a particular associativity, e.g. left-to-right, you should write @@ -595,6 +600,16 @@ Iterable Collections Determine whether every element of ``a`` is also in ``b``, using the ``in`` function. +.. function:: filter(function, collection) + + Return a copy of ``collection``, removing elements for which ``function`` is false. + For associative collections, the function is passed two arguments (key and value). + +.. function:: filter!(function, collection) + + Update ``collection``, removing elements for which ``function`` is false. + For associative collections, the function is passed two arguments (key and value). + Indexable Collections --------------------- @@ -669,18 +684,6 @@ As with arrays, ``Dicts`` may be created with comprehensions. For example, Update collection with pairs from the other collections -.. function:: filter(function, collection) - - Return a copy of collection, removing (key, value) pairs for which function is false. - -.. function:: filter!(function, collection) - - Update collection, removing (key, value) pairs for which function is false. - -.. function:: eltype(collection) - - Returns the type tuple of the (key,value) pairs contained in collection. - .. function:: sizehint(s, n) Suggest that collection ``s`` reserve capacity for at least ``n`` elements. This can improve performance. @@ -3271,10 +3274,6 @@ Basic functions Returns a tuple containing the dimensions of A -.. function:: eltype(A) - - Returns the type of the elements contained in A - .. function:: iseltype(A,T) Tests whether A or its elements are of type T