From 08e424ea070b1ac995376d4ad0eba9d580e0bead Mon Sep 17 00:00:00 2001 From: michiboo Date: Sat, 23 Jan 2021 08:38:12 +0200 Subject: [PATCH] add doc on suffix method --- Sources/Algorithms/Suffix.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sources/Algorithms/Suffix.swift b/Sources/Algorithms/Suffix.swift index 1cc10ac..1978bb9 100644 --- a/Sources/Algorithms/Suffix.swift +++ b/Sources/Algorithms/Suffix.swift @@ -14,6 +14,15 @@ //===----------------------------------------------------------------------===// extension BidirectionalCollection { + /// Returns a subsequence containing the elements from the end until `predicate` + /// returns `false` and skipping the remaining elements. + /// + /// - Parameter predicate: A closure that takes an element of the + /// sequence as its argument and returns `true` if the element should + /// be included or `false` if it should be excluded. Once the predicate + /// returns `false` it will not be called again. + /// + /// - Complexity: O(*n*), where *n* is the length of the collection. public func suffix( while predicate: (Element) throws -> Bool ) rethrows -> SubSequence {