From 7c990fc09d8f6f366e99641155a7564c64f01a8a Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Mon, 14 May 2012 15:47:56 -0700 Subject: [PATCH] hash-sets: using ?adjoin to implement duplicates, some tests. --- core/hash-sets/hash-sets-tests.factor | 4 ++++ core/hash-sets/hash-sets.factor | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/hash-sets/hash-sets-tests.factor b/core/hash-sets/hash-sets-tests.factor index ca995a38e6..2432d9c5bf 100644 --- a/core/hash-sets/hash-sets-tests.factor +++ b/core/hash-sets/hash-sets-tests.factor @@ -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 diff --git a/core/hash-sets/hash-sets.factor b/core/hash-sets/hash-sets.factor index 6e624dec70..c009593c58 100644 --- a/core/hash-sets/hash-sets.factor +++ b/core/hash-sets/hash-sets.factor @@ -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 ;