mirror of
https://github.com/apple/swift-algorithms
synced 2026-11-28 04:44:20 +00:00
Clean up some comments (#49)
This commit is contained in:
1 parent
ff01a02c07
commit
7af7ac2599
3 files changed
+13
-15
No files matched your search
@@ -138,7 +138,7 @@ extension Collection {
|
||||
/// four colors:
|
||||
///
|
||||
/// let colors = ["fuchsia", "cyan", "mauve", "magenta"]
|
||||
/// for combo in colors.combinations(ofCount k: 3) {
|
||||
/// for combo in colors.combinations(ofCount: 3) {
|
||||
/// print(combo.joined(separator: ", "))
|
||||
/// }
|
||||
/// // fuchsia, cyan, mauve
|
||||
|
||||
@@ -213,7 +213,7 @@ extension MutableCollection {
|
||||
/// rotating.
|
||||
/// - Returns: The new index of the element that was first pre-rotation.
|
||||
///
|
||||
/// - Complexity: O(*n*)
|
||||
/// - Complexity: O(*n*), where *n* is the length of the collection.
|
||||
@inlinable
|
||||
@discardableResult
|
||||
public mutating func rotate(toStartAt newStart: Index) -> Index {
|
||||
@@ -273,7 +273,7 @@ extension MutableCollection where Self: BidirectionalCollection {
|
||||
/// rotating.
|
||||
/// - Returns: The new index of the element that was first pre-rotation.
|
||||
///
|
||||
/// - Complexity: O(*n*)
|
||||
/// - Complexity: O(*n*), where *n* is the length of the collection.
|
||||
@inlinable
|
||||
@discardableResult
|
||||
public mutating func rotate(toStartAt newStart: Index) -> Index {
|
||||
|
||||
@@ -11,22 +11,20 @@
|
||||
|
||||
extension BidirectionalCollection {
|
||||
|
||||
/// Returns a `SubSequence` formed by discarding all elements at the start and end of the collection
|
||||
/// which satisfy the given predicate.
|
||||
/// Returns a `SubSequence` formed by discarding all elements at the start and
|
||||
/// end of the collection which satisfy the given predicate.
|
||||
///
|
||||
/// This example uses `trimming(where:)` to get a substring without the white space at the
|
||||
/// beginning and end of the string:
|
||||
/// This example uses `trimming(where:)` to get a substring without the white
|
||||
/// space at the beginning and end of the string:
|
||||
///
|
||||
/// ```
|
||||
/// let myString = " hello, world "
|
||||
/// print(myString.trimming(where: \.isWhitespace)) // "hello, world"
|
||||
/// ```
|
||||
/// let myString = " hello, world "
|
||||
/// print(myString.trimming(where: \.isWhitespace)) // "hello, world"
|
||||
///
|
||||
/// - parameters:
|
||||
/// - predicate: A closure which determines if the element should be omitted from the
|
||||
/// resulting slice.
|
||||
/// - Parameters:
|
||||
/// - predicate: A closure which determines if the element should be
|
||||
/// omitted from the resulting slice.
|
||||
///
|
||||
/// - complexity: `O(n)`, where `n` is the length of this collection.
|
||||
/// - Complexity: O(*n*), where *n* is the length of this collection.
|
||||
///
|
||||
@inlinable
|
||||
public func trimming(
|
||||
|
||||
Reference in new issue
Block a user