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