Home / Docs / Standard library / Built-in methods

is_subset

Release v0.4.0Edition 0.5 preview

A built-in method, resolved by the type of its receiver (spec/14 §2). Edition 0.5 preview.

una
s.is_subset(of: Set[T]) -> Bool
  where s: Set[T]
s.is_subset(of: HashSet[T]) -> Bool
  where s: HashSet[T]
b.is_subset(of: BitSet) -> Bool
  where b: BitSet

Whether of holds every item of s. O(n + m), or less when s is much smaller (spec/28 §6). On a HashSet, O(n · |k|) expected (spec/28 §7). On a BitSet, of has its size, in O(size / 64) (spec/28 §9).

Specification

Generated from una v0.4.0 (docs/std/builtins.json, which is not part of the specification): built-in methods have no declaration, so una writes these signature lines and tests each against its checker. The specification governs: spec/14 §2.