insert ''a -> ''a list -> ''a list
- insert 1 [3,2]; > val it = [1, 3, 2] : int list - insert 1 it; > val it = [1, 3, 2] : int list
A high-performance implementation of finite sets may be found in structure HOLset.
ML equality types are used in the implementation of insert and its kin. This limits its applicability to types that allow equality. For other types, typically abstract ones, use the ‘op_’ variants.
One should not write code that depends on where the ‘list-as-set’ algorithms place elements in the list which is being considered as a set.