From 200e37671fa229f7bb4a170dc3f76a171f3ae8ad Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 26 Mar 2013 16:00:31 -0700 Subject: [PATCH] hash-sets: faster intersects?. --- core/hash-sets/hash-sets.factor | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/hash-sets/hash-sets.factor b/core/hash-sets/hash-sets.factor index 9c8d4fbfe9..e192944c1c 100644 --- a/core/hash-sets/hash-sets.factor +++ b/core/hash-sets/hash-sets.factor @@ -138,6 +138,12 @@ INSTANCE: hash-set set M: hash-set intersect (intersect) >hash-set ; +M: hash-set intersects? + over hash-set? [ + small/large [ array>> ] dip [ in? ] curry + [ if ] curry [ dup tombstone? [ drop t ] ] prepose any? + ] [ small/large sequence/tester any? ] if ; + M: hash-set union over hash-set? [ small/large [ array>> ] [ clone ] bi*