1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
|
// Written in the D programming language.
/**
This package implements generic algorithms oriented towards the processing of
sequences. Sequences processed by these functions define range-based
interfaces. See also $(MREF_ALTTEXT Reference on ranges, std, range) and
$(HTTP ddili.org/ders/d.en/ranges.html, tutorial on ranges).
$(SCRIPT inhibitQuickIndex = 1;)
Algorithms are categorized into the following submodules:
$(DIVC quickindex,
$(BOOKTABLE ,
$(TR $(TH Submodule) $(TH Functions)
)
$(TR
$(TDNW $(SUBMODULE Searching, searching))
$(TD
$(SUBREF searching, all)
$(SUBREF searching, any)
$(SUBREF searching, balancedParens)
$(SUBREF searching, boyerMooreFinder)
$(SUBREF searching, canFind)
$(SUBREF searching, commonPrefix)
$(SUBREF searching, count)
$(SUBREF searching, countUntil)
$(SUBREF searching, endsWith)
$(SUBREF searching, find)
$(SUBREF searching, findAdjacent)
$(SUBREF searching, findAmong)
$(SUBREF searching, findSkip)
$(SUBREF searching, findSplit)
$(SUBREF searching, findSplitAfter)
$(SUBREF searching, findSplitBefore)
$(SUBREF searching, minCount)
$(SUBREF searching, maxCount)
$(SUBREF searching, minElement)
$(SUBREF searching, maxElement)
$(SUBREF searching, minIndex)
$(SUBREF searching, maxIndex)
$(SUBREF searching, minPos)
$(SUBREF searching, maxPos)
$(SUBREF searching, skipOver)
$(SUBREF searching, startsWith)
$(SUBREF searching, until)
)
)
$(TR
$(TDNW $(SUBMODULE Comparison, comparison))
$(TD
$(SUBREF comparison, among)
$(SUBREF comparison, castSwitch)
$(SUBREF comparison, clamp)
$(SUBREF comparison, cmp)
$(SUBREF comparison, either)
$(SUBREF comparison, equal)
$(SUBREF comparison, isPermutation)
$(SUBREF comparison, isSameLength)
$(SUBREF comparison, levenshteinDistance)
$(SUBREF comparison, levenshteinDistanceAndPath)
$(SUBREF comparison, max)
$(SUBREF comparison, min)
$(SUBREF comparison, mismatch)
$(SUBREF comparison, predSwitch)
)
)
$(TR
$(TDNW $(SUBMODULE Iteration, iteration))
$(TD
$(SUBREF iteration, cache)
$(SUBREF iteration, cacheBidirectional)
$(SUBREF iteration, chunkBy)
$(SUBREF iteration, cumulativeFold)
$(SUBREF iteration, each)
$(SUBREF iteration, filter)
$(SUBREF iteration, filterBidirectional)
$(SUBREF iteration, fold)
$(SUBREF iteration, group)
$(SUBREF iteration, joiner)
$(SUBREF iteration, map)
$(SUBREF iteration, mean)
$(SUBREF iteration, permutations)
$(SUBREF iteration, reduce)
$(SUBREF iteration, splitWhen)
$(SUBREF iteration, splitter)
$(SUBREF iteration, substitute)
$(SUBREF iteration, sum)
$(SUBREF iteration, uniq)
)
)
$(TR
$(TDNW $(SUBMODULE Sorting, sorting))
$(TD
$(SUBREF sorting, completeSort)
$(SUBREF sorting, isPartitioned)
$(SUBREF sorting, isSorted)
$(SUBREF sorting, isStrictlyMonotonic)
$(SUBREF sorting, ordered)
$(SUBREF sorting, strictlyOrdered)
$(SUBREF sorting, makeIndex)
$(SUBREF sorting, merge)
$(SUBREF sorting, multiSort)
$(SUBREF sorting, nextEvenPermutation)
$(SUBREF sorting, nextPermutation)
$(SUBREF sorting, nthPermutation)
$(SUBREF sorting, partialSort)
$(SUBREF sorting, partition)
$(SUBREF sorting, partition3)
$(SUBREF sorting, schwartzSort)
$(SUBREF sorting, sort)
$(SUBREF sorting, topN)
$(SUBREF sorting, topNCopy)
$(SUBREF sorting, topNIndex)
)
)
$(TR
$(TDNW Set operations $(BR)($(SUBMODULE setops, setops)))
$(TD
$(SUBREF setops, cartesianProduct)
$(SUBREF setops, largestPartialIntersection)
$(SUBREF setops, largestPartialIntersectionWeighted)
$(SUBREF setops, multiwayMerge)
$(SUBREF setops, multiwayUnion)
$(SUBREF setops, setDifference)
$(SUBREF setops, setIntersection)
$(SUBREF setops, setSymmetricDifference)
)
)
$(TR
$(TDNW $(SUBMODULE Mutation, mutation))
$(TD
$(SUBREF mutation, bringToFront)
$(SUBREF mutation, copy)
$(SUBREF mutation, fill)
$(SUBREF mutation, initializeAll)
$(SUBREF mutation, move)
$(SUBREF mutation, moveAll)
$(SUBREF mutation, moveSome)
$(SUBREF mutation, moveEmplace)
$(SUBREF mutation, moveEmplaceAll)
$(SUBREF mutation, moveEmplaceSome)
$(SUBREF mutation, remove)
$(SUBREF mutation, reverse)
$(SUBREF mutation, strip)
$(SUBREF mutation, stripLeft)
$(SUBREF mutation, stripRight)
$(SUBREF mutation, swap)
$(SUBREF mutation, swapRanges)
$(SUBREF mutation, uninitializedFill)
)
)
))
Many functions in this package are parameterized with a $(GLOSSARY predicate).
The predicate may be any suitable callable type
(a function, a delegate, a $(GLOSSARY functor), or a lambda), or a
compile-time string. The string may consist of $(B any) legal D
expression that uses the symbol `a` (for unary functions) or the
symbols `a` and `b` (for binary functions). These names will NOT
interfere with other homonym symbols in user code because they are
evaluated in a different context. The default for all binary
comparison predicates is `"a == b"` for unordered operations and
`"a < b"` for ordered operations.
Example:
----
int[] a = ...;
static bool greater(int a, int b)
{
return a > b;
}
sort!greater(a); // predicate as alias
sort!((a, b) => a > b)(a); // predicate as a lambda.
sort!"a > b"(a); // predicate as string
// (no ambiguity with array name)
sort(a); // no predicate, "a < b" is implicit
----
Macros:
SUBMODULE = $(MREF_ALTTEXT $1, std, algorithm, $2)
SUBREF = $(REF_ALTTEXT $(TT $2), $2, std, algorithm, $1)$(NBSP)
Copyright: Andrei Alexandrescu 2008-.
License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: $(HTTP erdani.com, Andrei Alexandrescu)
Source: $(PHOBOSSRC std/algorithm/package.d)
*/
module std.algorithm;
public import std.algorithm.comparison;
public import std.algorithm.iteration;
public import std.algorithm.mutation;
public import std.algorithm.searching;
public import std.algorithm.setops;
public import std.algorithm.sorting;
static import std.functional;
|