# MIT License, Copyright (c) 2023 Marvin Borner # Generic set implementation using AVL trees # some functions require a compare-case argument! :import std/Tree/Balanced T :import std/List . # empty set empty T.empty ⧗ Set # adds a number of a set add T.insert ⧗ Compare → Number → Set → Set # returns true if a number is in a set has? T.has? ⧗ Compare → Number → Set → Boolean # count of elements in set size T.size ⧗ Set → Number # converts a set to a list set→list T.tree→list ⧗ Set → (List Number) # converts a list to a set list→set T.list→tree ⧗ Compare → (List Number) → Set