aboutsummaryrefslogtreecommitdiff
path: root/src/crates/library/src/vecset.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/crates/library/src/vecset.rs')
-rw-r--r--src/crates/library/src/vecset.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/crates/library/src/vecset.rs b/src/crates/library/src/vecset.rs
index ccf747a..f596161 100644
--- a/src/crates/library/src/vecset.rs
+++ b/src/crates/library/src/vecset.rs
@@ -1,5 +1,5 @@
/*LIBSPEC-NAME*
-rust-eager-unique-vec-spec primrose_library::VecSet
+rust-vecset-spec primrose_library::VecSet
*ENDLIBSPEC-NAME*/
use crate::traits::{Container, Indexable};
@@ -76,7 +76,7 @@ impl<T: Ord + PartialEq> Container<T> for VecSet<T> {
len op-len pre-len post-len
*ENDOPNAME*/
(define (op-len xs) (cons xs (length xs)))
- (define (pre-len xs) (equal? xs (sort xs)))
+ (define (pre-len xs) (equal? xs (remove-duplicates xs)))
(define (post-len xs r) (equal? r (op-len xs)))
*ENDLIBSPEC*/
fn len(&self) -> usize {
@@ -91,7 +91,7 @@ impl<T: Ord + PartialEq> Container<T> for VecSet<T> {
(cond
[(list? (member x xs)) (cons xs #t)]
[else (cons xs #f)]))
- (define (pre-contains xs) (equal? xs (sort xs)))
+ (define (pre-contains xs) (equal? xs (remove-duplicates xs)))
(define (post-contains xs x r) (equal? r (op-contains xs x)))
*ENDLIBSPEC*/
fn contains(&self, x: &T) -> bool {
@@ -103,7 +103,7 @@ impl<T: Ord + PartialEq> Container<T> for VecSet<T> {
is-empty op-is-empty pre-is-empty post-is-empty
*ENDOPNAME*/
(define (op-is-empty xs) (cons xs (null? xs)))
- (define (pre-is-empty xs) (equal? xs (sort xs)))
+ (define (pre-is-empty xs) (equal? xs (remove-duplicates xs)))
(define (post-is-empty xs r) (equal? r (op-is-empty xs)))
*ENDLIBSPEC*/
fn is_empty(&self) -> bool {
@@ -115,7 +115,7 @@ impl<T: Ord + PartialEq> Container<T> for VecSet<T> {
clear op-clear pre-clear post-clear
*ENDOPNAME*/
(define (op-clear xs) null)
- (define (pre-clear xs) (equal? xs (sort xs)))
+ (define (pre-clear xs) (equal? xs (remove-duplicates xs)))
(define (post-clear xs r) (equal? r (op-clear xs)))
*ENDLIBSPEC*/
fn clear(&mut self) {
@@ -126,8 +126,8 @@ impl<T: Ord + PartialEq> Container<T> for VecSet<T> {
/*OPNAME*
insert op-insert pre-insert post-insert
*ENDOPNAME*/
- (define (op-insert xs x) (sort (append xs (list x))))
- (define (pre-insert xs) (equal? xs (sort xs)))
+ (define (op-insert xs x) (remove-duplicates (append xs (list x))))
+ (define (pre-insert xs) (equal? xs (remove-duplicates xs)))
(define (post-insert xs x ys) (equal? ys (op-insert xs x)))
*ENDLIBSPEC*/
fn insert(&mut self, elt: T) {
@@ -142,7 +142,7 @@ impl<T: Ord + PartialEq> Container<T> for VecSet<T> {
(cond
[(list? (member x xs)) (cons (remove x xs) x)]
[else (cons xs null)]))
- (define (pre-remove xs) (equal? xs (sort xs)))
+ (define (pre-remove xs) (equal? xs (remove-duplicates xs)))
(define (post-remove xs r) (equal? r (op-remove xs)))
*ENDLIBSPEC*/
fn remove(&mut self, elt: T) -> Option<T> {