Add singleton utility
This commit is contained in:
parent
d8c81e8625
commit
0b39ba8124
|
@ -174,12 +174,18 @@ public extension IterableFuzzySet where Universe: Hashable {
|
|||
|
||||
public extension IterableFuzzySet where S == Set<Universe> {
|
||||
static func fromCrispSet(_ set: S) -> Self {
|
||||
.init(set, membershipFunction: .one)
|
||||
.init(set, membershipFunction: .fromCrispSet(set))
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Utility
|
||||
|
||||
public extension IterableFuzzySet where Universe: Equatable, S == Array<Universe> {
|
||||
static func singleton(_ u: Universe) -> Self {
|
||||
.init([u], membershipFunction: .fuzzySingleton(u))
|
||||
}
|
||||
}
|
||||
|
||||
extension IterableFuzzySet.Element: Equatable where Universe: Equatable {}
|
||||
extension IterableFuzzySet.Element: Hashable where Universe: Hashable {}
|
||||
extension IterableFuzzySet.Element: Encodable where Universe: Encodable {}
|
||||
|
|
Loading…
Reference in New Issue