mirror of
https://github.com/apple/swift-algorithms
synced 2026-11-24 04:17:48 +00:00
Fix misspelling in the guides
This commit is contained in:
1 parent
cffb44dceb
commit
60d653f008
10 files changed
+10
-10
No files matched your search
+1
-1
@@ -41,7 +41,7 @@ the first and second arguments conform.
|
||||
This method’s and type’s name match the term of art used in other languages and
|
||||
libraries.
|
||||
|
||||
### Comparison with other langauges
|
||||
### Comparison with other languages
|
||||
|
||||
**Rust:** Rust provides a `chain` function that concatenates two iterators.
|
||||
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ The operation performed by these methods is similar to other ways of breaking a
|
||||
- `sliced`: *Not included in this package or the stdlib.* Breaks a collection into potentially overlapping subsequences.
|
||||
|
||||
|
||||
### Comparison with other langauges
|
||||
### Comparison with other languages
|
||||
|
||||
**Ruby:** Ruby’s `Enumerable` class defines `chunk_while` and `chunk`, which map
|
||||
to the proposed `chunked(by:)` and `chunked(on:)` methods.
|
||||
|
||||
@@ -74,7 +74,7 @@ Swift API guidelines. A few other options were considered:
|
||||
- `k` is used a term of art for combinations and permutations, but isn't
|
||||
widely used in programming contexts.
|
||||
|
||||
### Comparison with other langauges
|
||||
### Comparison with other languages
|
||||
|
||||
**Rust/Ruby/Python:** Rust, Ruby, and Python all define functions with
|
||||
essentially the same semantics as the method described here.
|
||||
+1
-1
@@ -50,7 +50,7 @@ run-through of elements (the actual semantics) or starting after the first
|
||||
set. This ambiguity is present in all the different potential names for this
|
||||
function: `repeated(times:)`, `cycled(repetitions:)`, etc.
|
||||
|
||||
### Comparison with other langauges
|
||||
### Comparison with other languages
|
||||
|
||||
**Rust:** The `cycle` method repeats an iterator's elements forever. I don’t see
|
||||
anything that matches the `cycled(times:)` behavior.
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ to eventually land in the standard library.
|
||||
`partitioningIndex(where:)` is a slight generalization of a binary search, and
|
||||
is an O(_log n_) operation for random-access collections; O(_n_) otherwise.
|
||||
|
||||
### Comparison with other langauges
|
||||
### Comparison with other languages
|
||||
|
||||
**C++:** The `<algorithm>` library defines `partition`, `stable_partition`, and
|
||||
`partition_point` functions with similar semantics to these. Notably, in the C++
|
||||
|
||||
@@ -87,7 +87,7 @@ O(_n_) operation.
|
||||
|
||||
See the ["Naming" section for `combinations(ofCount:)`](Combinations.md#naming) for detail.
|
||||
|
||||
### Comparison with other langauges
|
||||
### Comparison with other languages
|
||||
|
||||
**C++:** The `<algorithm>` library defines a `next_permutation` function that
|
||||
advances an array of comparable values through their lexicographic orderings.
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ collections. While `product` is precedented in other languages, the name has an
|
||||
unfortunate overlap with multiplication, where `product(numbers1, numbers2)`
|
||||
could be seen as producing an element-wise product.
|
||||
|
||||
### Comparison with other langauges
|
||||
### Comparison with other languages
|
||||
|
||||
**Ruby:** You can call the `product` method on an array, passing one or more
|
||||
arrays to form n-ary tuples — passing a single array gives the same semantics as
|
||||
|
||||
@@ -74,7 +74,7 @@ returns a single random element. The `randomSample(count:)` name is chosen to
|
||||
align with `randomElement`, but be more distinguishable than something like
|
||||
`randomElements`. Other names considered include `sample` and `choose`.
|
||||
|
||||
### Comparison with other langauges
|
||||
### Comparison with other languages
|
||||
|
||||
**C++:** As of C++17, the `<algorithm>` library includes a `sample` function
|
||||
that provides linear performance. This algorithm is stable for all source
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ For the range-based overloads, the label could be omitted. That is, instead of
|
||||
using `subrange:`, the method could be called as
|
||||
`numbers.rotate(0..<3, at: 2)`.
|
||||
|
||||
### Comparison with other langauges
|
||||
### Comparison with other languages
|
||||
|
||||
**C++:** The `<algorithm>` library defines a `rotate` function with similar
|
||||
semantics to this one.
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ extension Sequence {
|
||||
|
||||
The `uniqued` methods are O(_n_) in both time and space complexity.
|
||||
|
||||
### Comparison with other langauges
|
||||
### Comparison with other languages
|
||||
|
||||
**C+\+:** The `<algorithm>` library defines a `unique` function that removes
|
||||
consecutive equal elements.
|
||||
|
||||
Reference in new issue
Block a user