Collection

extension Collection
  • Declaration

    Swift

    public func subsets(cardinality k: Int) -> [[Element]]

    Return Value

    All combinations of with a given cardinality (i.e., how many elements chosen per combination).

  • All of the permutations of each of the elements in each of the given sequences.

    Declaration

    Swift

    public var permutations: [[Element]] { get }
  • Declaration

    Swift

    public func split(at index: Index) -> (SubSequence, SubSequence)?

    Return Value

    A two-tuple containing two arrays of Elements split at the given index, if the given index is in the bounds of self. Otherwise, nil.

    • The elements to the left of the element at the given index

    • The element at the given index

    • The elements to the right of the element at the given index

    if the given index is in the bounds of self. Otherwise, nil.

    Declaration

    Swift

    public func splitAndExtractElement(at index: Index) -> (SubSequence, Element, SubSequence)?

    Return Value

    A three-tuple containing: