]> gitweb.factorcode.org Git - factor.git/commitdiff
hash-sets: using ?adjoin to implement duplicates, some tests.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 14 May 2012 22:47:56 +0000 (15:47 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 14 May 2012 22:47:56 +0000 (15:47 -0700)
core/hash-sets/hash-sets-tests.factor
core/hash-sets/hash-sets.factor

index ca995a38e62fa69a522afde89b43a7112a2712b0..2432d9c5bf8086dc15ca6703de1046bb10bb081d 100644 (file)
@@ -34,3 +34,7 @@ IN: hash-sets.tests
 
 [ t ] [ HS{ } null? ] unit-test
 [ f ] [ HS{ 1 } null? ] unit-test
+
+{ { } } [ { 1 2 3 } duplicates ] unit-test
+{ f } [ { 1 2 3 } >hash-set duplicates ] unit-test
+{ { 1 } } [ { 1 2 1 } duplicates ] unit-test
index 6e624dec708d5e22fa2279bc904e49c5b11bad77..c009593c58e1f00e20905c0f5c879c1a49505ecf 100644 (file)
@@ -31,7 +31,7 @@ M: sequence fast-set >hash-set ;
 M: f fast-set drop H{ } clone hash-set boa ;
 
 M: sequence duplicates
-    f fast-set [ [ in? ] [ adjoin ] 2bi ] curry filter ;
+    f fast-set [ ?adjoin not ] curry filter ;
 
 <PRIVATE