(module set mzscheme
(require "private/require.ss")
(require-contracts)
(require-etc)
(require (lib "class.ss")
"private/contracts.ss"
"set/set-interface.ss"
"set/unordered-set.ss"
"set/ordered-set.ss"
"set/hashed-set.ss")
(provide/contract
[set? predicate/c]
[set/c flat-contract?]
[non-empty-set/c flat-contract?]
[set-of/c (flat-contract/c . -> . flat-contract?)]
[non-empty-set-of/c (flat-contract/c . -> . flat-contract?)]
[make-ordered ([comparison/c] (listof any/c) . ->* . [set/c])]
[make-hashed ([hash-fn/c equality/c] (listof any/c) . ->* . [set/c])]
[make-unordered ([equality/c] (listof any/c) . ->* . [set/c])]
[make-eq ([] (listof any/c) . ->* . [set/c])]
[make-eqv ([] (listof any/c) . ->* . [set/c])]
[make-equal ([] (listof any/c) . ->* . [set/c])]
[list->ordered (comparison/c (listof any/c) . -> . set/c)]
[list->hashed (hash-fn/c equality/c (listof any/c) . -> . set/c)]
[list->unordered (equality/c (listof any/c) . -> . set/c)]
[list->eq ((listof any/c) . -> . set/c)]
[list->eqv ((listof any/c) . -> . set/c)]
[list->equal ((listof any/c) . -> . set/c)]
[elements (set/c . -> . (listof any/c))]
[size (set/c . -> . natural-number/c)]
[member? (any/c set/c . -> . boolean?)]
[lookup ([any/c set/c] [(-> any) (any/c . -> . any)] . opt-> . any)]
[insert (any/c set/c . -> . non-empty-set/c)]
[remove (any/c set/c . -> . set/c)]
[select (non-empty-set/c . -> . any/c)]
[clear (set/c . -> . set/c)]
[rename set-empty? empty? (set/c . -> . boolean?)]
[rename set-fold fold ((any/c any/c . -> . any/c) any/c set/c . -> . any)]
[rename set-map map ((any/c . -> . any/c) set/c . -> . set/c)]
[rename set-for-each for-each ((any/c . -> . void?) set/c . -> . void?)]
[rename set-filter filter ((any/c . -> . any/c) set/c . -> . set/c)]
[any? ((any/c . -> . any/c) set/c . -> . boolean?)]
[all? ((any/c . -> . any/c) set/c . -> . boolean?)]
[rename set-ormap ormap ((any/c . -> . any/c) set/c . -> . boolean?)]
[rename set-andmap andmap ((any/c . -> . any/c) set/c . -> . boolean?)]
[union ([set/c set/c] [(any/c any/c . -> . any/c)] . opt-> . set/c)]
[intersection
([set/c set/c] [(any/c any/c . -> . any/c)] . opt-> . set/c)]
[difference (set/c set/c . -> . set/c)]
[subset? (set/c set/c . -> . boolean?)]
[rename set-equal? equal? (set/c set/c . -> . boolean?)]
)
(define list->ordered make-ordered-set)
(define (make-ordered compare . elems)
(list->ordered compare elems))
(define list->hashed make-hashed-set)
(define (make-hashed hash equ? . elems)
(list->hashed hash equ? elems))
(define list->unordered make-unordered-set)
(define (make-unordered equ? . elems)
(list->unordered equ? elems))
(define (list->eq elements)
(list->hashed eq-hash-code eq? elements))
(define (make-eq . elements)
(list->eq elements))
(define (list->eqv elements)
(list->unordered eqv? elements))
(define (make-eqv . elements)
(list->eqv elements))
(define (list->equal elements)
(list->hashed equal-hash-code equal? elements))
(define (make-equal . elements)
(list->equal elements))
(define (elements set)
(send set elements))
(define (insert elem set)
(send set insert elem))
(define (lookup elem set . rest)
(send set lookup elem . rest))
(define (remove elem set)
(send set remove elem))
(define (select set)
(send set select))
(define (set-empty? set)
(send set empty?))
(define (clear set)
(send set clear))
(define (size set)
(send set size))
(define (member? elem set)
(send set member? elem))
(define (set-fold f init set)
(send set fold f init))
(define (set-map f set)
(send set map f))
(define (set-for-each action set)
(send set for-each action))
(define (set-filter f set)
(send set filter f))
(define (any? f set)
(send set any? f))
(define set-ormap any?)
(define (all? f set)
(send set all? f))
(define set-andmap all?)
(define (union one two . rest)
(send one union two . rest))
(define (intersection one two . rest)
(send one intersection two . rest))
(define (difference one two)
(send one difference two))
(define (subset? one two)
(send one subset? two))
(define (set-equal? one two)
(send one equal? two))
)