(module hashed-bag mzscheme
(require "../private/require.ss")
(require-contracts)
(require-class)
(require-lists)
(require "../table/hashed-table.ss"
"bag-interface.ss"
"bag-from-table.ss")
(provide/contract
[hashed-bag% (implementation?/c bag<%>)]
[make-hashed-bag (([hash hash-fn/c]
[equ? equality/c]
[elems (listof any/c)])
. ->r . bag/c)])
(define (make-hashed-bag hash equ? elems)
(foldl (lambda (elem bag)
(send bag insert elem))
(make-bag-from-table (make-hashed-table hash equ? null null))
elems))
(define hashed-bag% bag-from-table%)
)