diff --git a/collects/racket/set.rkt b/collects/racket/set.rkt index 3dc363eb81..2d007c66c7 100644 --- a/collects/racket/set.rkt +++ b/collects/racket/set.rkt @@ -6,7 +6,7 @@ set-empty? set-count set-member? set-add set-remove set-union set-intersect set-subtract - set-subset? + subset? set-map set-for-each (rename-out [*in-set in-set]) for/set for/seteq for/seteqv @@ -164,9 +164,9 @@ (for/fold ([set set]) ([set2 (in-list sets)]) (set-subtract set set2))])) -(define (set-subset? set1 set2) - (unless (set? set1) (raise-type-error 'set-subset? "set" 0 set1 set2)) - (unless (set? set2) (raise-type-error 'set-subset? "set" 1 set1 set2)) +(define (subset? set2 set1) + (unless (set? set2) (raise-type-error 'subset? "set" 0 set2 set1)) + (unless (set? set1) (raise-type-error 'subset? "set" 0 set2 set1)) (let ([ht1 (set-ht set1)] [ht2 (set-ht set2)]) (unless (and (eq? (hash-eq? ht1) (hash-eq? ht2)) diff --git a/collects/scribblings/reference/sets.scrbl b/collects/scribblings/reference/sets.scrbl index a61ff00c9f..358ca31364 100644 --- a/collects/scribblings/reference/sets.scrbl +++ b/collects/scribblings/reference/sets.scrbl @@ -103,13 +103,13 @@ runs in time proportional to the total size of all given @scheme[set]s except the first one.} -@defproc[(set-subset? [set set?] [set2 set?]) boolean?]{ +@defproc[(subset? [set set?] [set2 set?]) boolean?]{ -Returns @scheme[#t] if every member of @scheme[set2] is in -@scheme[set], @scheme[#f] otherwise. The @scheme[set] and +Returns @scheme[#t] if every member of @scheme[set] is in +@scheme[set2], @scheme[#f] otherwise. The @scheme[set] and @scheme[set2] must use the same equivalence predicate (@scheme[equal?], @scheme[eq?], or @scheme[eqv?]). This operation -runs in time proportional to the size of @scheme[set2].} +runs in time proportional to the size of @scheme[set].} @defproc[(set-map [set set?] diff --git a/collects/tests/mzscheme/set.ss b/collects/tests/mzscheme/set.ss index 9632b1fb3f..1089b48cb2 100644 --- a/collects/tests/mzscheme/set.ss +++ b/collects/tests/mzscheme/set.ss @@ -50,10 +50,10 @@ (test #t set-member? (set-remove s 5) 3) (test #f set-member? (set-remove s 3) 3) - (test #t set-subset? s (set 1 3)) - (test #t set-subset? s (set 1 2 3)) - (test #f set-subset? s (set 1 4)) - (test #t set-subset? s (set)) + (test #t subset? (set 1 3) s) + (test #t subset? (set 1 2 3) s) + (test #f subset? (set 1 4) s) + (test #t subset? (set) s) (test 3 set-count (set-union s)) (test 6 set-count (set-union s (set 3 4 5 6)))