Set
In the prelude: every iyi program has it, with no import.
A Hash whose values are nothing: the same dense keys in insertion order and the same index over them, so add, includes? and delete cost what the hash's do and iteration reads back in the order things went in. It is a wrapper rather than a copy of hash.iyi because the index is the part worth getting right once. The sample that asked for it (samples/iyi/visited.iyi) walks a graph with a cycle in it, and add answering whether the element was new is the one bit that walk needs.
Set(T)class
class Set(T)
# Not in `other`, in this order; `other` may be of another element type.
def -(other : Set(U)) : Set(T) forall U
# True when the element was not there before.
def add(value : T) : Bool
# True when the element was there.
def delete(value : T) : Bool
# Every element, in the order it went in.
def each(& : (T -> Nil)) : Nil
def empty? : Bool
def includes?(value : T) : Bool
def inspect : String
def new
def size : Int32
def to_a : Array(T)
# `Set{"a", "b"}`, in insertion order, elements inspected.
def to_s : String
end
The one set — "have I seen this", with nothing attached to the answer.