Skip to content
Browse files

hash-sets: speed up diff, intersect, and union.

  • Loading branch information...
1 parent cbde9a4 commit b0a2027e7185b32b654e0e64deecd22fc134e29b @mrjbq7 committed Apr 16, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 core/hash-sets/hash-sets.factor
View
5 core/hash-sets/hash-sets.factor
@@ -1,6 +1,6 @@
! Copyright (C) 2010 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs hashtables kernel sets
+USING: accessors assocs hashtables kernel sets sets.private
sequences parser ;
IN: hash-sets
@@ -23,6 +23,9 @@ M: hash-set set-like drop dup hash-set? [ members >hash-set ] unless ;
M: hash-set clone table>> clone hash-set boa ;
M: hash-set null? table>> assoc-empty? ;
M: hash-set cardinality table>> assoc-size ;
+M: hash-set intersect small/large sequence/tester filter >hash-set ;
+M: hash-set union [ members ] bi@ append >hash-set ;
+M: hash-set diff sequence/tester [ not ] compose filter >hash-set ;
M: sequence fast-set >hash-set ;
M: f fast-set drop H{ } clone hash-set boa ;

0 comments on commit b0a2027

Please sign in to comment.
Something went wrong with that request. Please try again.