Skip to content

Commit

Permalink
Fill in many Collection APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
aabewhite committed Nov 1, 2023
1 parent f81dc26 commit 3dec73d
Show file tree
Hide file tree
Showing 5 changed files with 418 additions and 132 deletions.
37 changes: 9 additions & 28 deletions Sources/SkipLib/Collections.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ extension Sequence {
fatalError()
}

@available(*, unavailable)
public func suffix(_ maxLength: Int) -> [Element] {
fatalError()
}
Expand All @@ -74,17 +73,14 @@ extension Sequence {
fatalError()
}

@available(*, unavailable)
public func drop(while predicate: (Element) throws -> Bool) rethrows -> [Element] /* DropWhileSequence<Self> */ {
fatalError()
}

@available(*, unavailable)
public func prefix(_ maxLength: Int) -> [Element] /* PrefixSequence<Self> */ {
fatalError()
}

@available(*, unavailable)
public func prefix(while predicate: (Element) throws -> Bool) rethrows -> [Element] {
fatalError()
}
Expand All @@ -105,8 +101,11 @@ extension Sequence {
fatalError()
}

@available(*, unavailable)
public func elementsEqual(_ other: Any, by areEquivalent: (Element, Element) throws -> Bool) rethrows -> Bool {
public func elementsEqual(_ other: any Sequence<Element>) -> Bool {
fatalError()
}

public func elementsEqual(_ other: any Sequence<Element>, by areEquivalent: (Element, Element) throws -> Bool) rethrows -> Bool {
fatalError()
}

Expand Down Expand Up @@ -168,11 +167,6 @@ extension Sequence {
fatalError()
}

@available(*, unavailable)
public func elementsEqual(_ other: Any) -> Bool {
fatalError()
}

public func contains(_ element: Element) -> Bool {
fatalError()
}
Expand Down Expand Up @@ -241,11 +235,9 @@ extension Collection {
fatalError()
}

@available(*, unavailable)
public func formIndex(after i: inout Int) {
}

@available(*, unavailable)
public func formIndex(_ i: inout Int, offsetBy distance: Int) {
}

Expand All @@ -270,17 +262,14 @@ extension Collection {
fatalError()
}

@available(*, unavailable)
public func prefix(upTo end: Int) -> [Element] /* Collection<Element> */ {
fatalError()
}

@available(*, unavailable)
public func suffix(from start: Int) -> [Element] /* Collection<Element> */ {
fatalError()
}

@available(*, unavailable)
public func prefix(through end: Int) -> [Element] /* Collection<Element> */ {
fatalError()
}
Expand All @@ -289,7 +278,6 @@ extension Collection {
fatalError()
}

@available(*, unavailable)
public mutating func removeFirst(_ k: Int) {
}

Expand Down Expand Up @@ -323,12 +311,10 @@ extension Collection {
fatalError()
}

@available(*, unavailable)
public func trimmingPrefix(while predicate: (Element) throws -> Bool) rethrows -> [Element] /* Collection<Element> */ {
fatalError()
}

@available(*, unavailable)
public mutating func trimPrefix(while predicate: (Element) throws -> Bool) throws {
}

Expand Down Expand Up @@ -361,12 +347,10 @@ public protocol BidirectionalCollection : Collection {
}

extension BidirectionalCollection {
@available(*, unavailable)
public func index(before i: Int) -> Int {
fatalError()
}

@available(*, unavailable)
public func formIndex(before i: inout Int) {
}

Expand All @@ -378,12 +362,10 @@ extension BidirectionalCollection {
fatalError()
}

@available(*, unavailable)
public func lastIndex(of element: Element) -> Int? {
fatalError()
}

@available(*, unavailable)
public func lastIndex(where predicate: (Element) throws -> Bool) rethrows -> Int? {
fatalError()
}
Expand Down Expand Up @@ -480,11 +462,9 @@ extension RangeReplaceableCollection {
public mutating func insert(_ newElement: Element, at i: Int) {
}

@available(*, unavailable)
public mutating func insert(contentsOf newElements: any Sequence<Element>, at i: Int) {
}

@available(*, unavailable)
public mutating func remove(at i: Int) -> Element {
fatalError()
}
Expand All @@ -496,7 +476,6 @@ extension RangeReplaceableCollection {
public mutating func removeAll(keepingCapacity keepCapacity: Bool = false) {
}

@available(*, unavailable)
public mutating func removeAll(where shouldBeRemoved: (Element) throws -> Bool) rethrows {
}

Expand Down Expand Up @@ -566,11 +545,9 @@ extension MutableCollection {
set {}
}

@available(*, unavailable)
mutating func swapAt(_ i: Int, _ j: Int) {
}

@available(*, unavailable)
public mutating func reverse() {
}
}
Expand Down Expand Up @@ -600,6 +577,10 @@ public func stride<T>(from start: T, through end: T, by stride: T) -> any Sequen
fatalError()
}

public func zip<E1, E2>(_ sequence1: any Sequence<E1>, _ sequence2: any Sequence<E2>) -> [(E1, E2)] {
fatalError()
}

// MARK: - Helpers

@available(*, unavailable)
Expand Down
Loading

0 comments on commit 3dec73d

Please sign in to comment.