I got the answer on how to implement `dropLast(while:)`

. I was using `suffix(while:)`

from Swift Algorithms. So I was looking at the source of `.suffix(while:)`

and saw this:

```
extension BidirectionalCollection {
/// Returns the inclusive lower bound of the suffix of elements that satisfy
/// the predicate.
///
/// - Parameter predicate: A closure that takes an element of the collection
/// as its argument and returns `true` if the element is part of the suffix
/// or `false` if it is not. Once the predicate returns `false` it will not
/// be called again.
///
/// - Complexity: O(*n*), where *n* is the length of the collection.
@inlinable
internal func startOfSuffix(
while predicate: (Element) throws -> Bool
) rethrows -> Index {
var index = endIndex
while index != startIndex {
let after = index
formIndex(before: &index)
if try !predicate(self[index]) {
return after
}
}
return index
}
}
```

seems this is kind of re-inventing the wheel and can be much simplified by using `BidirectionalCollection.lastIndex(where:)`

.