|
|
@ -1,11 +1,27 @@
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
|
|
|
|
public extension Array where Element : CustomStringConvertible {
|
|
|
|
public extension Array where Element: CustomStringConvertible {
|
|
|
|
|
|
|
|
|
|
|
|
var prettifiedDescription: String {
|
|
|
|
var prettifiedDescription: String {
|
|
|
|
return "[ " + map { $0.description }.joined(separator: ", ") + " ]"
|
|
|
|
return "[ " + map { $0.description }.joined(separator: ", ") + " ]"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public extension Array {
|
|
|
|
|
|
|
|
func appending(_ other: Element) -> [Element] {
|
|
|
|
|
|
|
|
var updatedArray: [Element] = self
|
|
|
|
|
|
|
|
updatedArray.append(other)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return updatedArray
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func appending(_ other: [Element]) -> [Element] {
|
|
|
|
|
|
|
|
var updatedArray: [Element] = self
|
|
|
|
|
|
|
|
updatedArray.append(contentsOf: other)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return updatedArray
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public extension Array where Element: Hashable {
|
|
|
|
public extension Array where Element: Hashable {
|
|
|
|
func asSet() -> Set<Element> {
|
|
|
|
func asSet() -> Set<Element> {
|
|
|
|
return Set(self)
|
|
|
|
return Set(self)
|
|
|
|