]> gitweb.factorcode.org Git - factor.git/commitdiff
interval-sets: can just check one side or the other.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 19 May 2014 16:40:51 +0000 (09:40 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 19 May 2014 16:40:51 +0000 (09:40 -0700)
basis/interval-sets/interval-sets.factor

index 62f9b479698bb14e283803d9a3a8a1136daf68a2..6668a3c9102cc7ecbbc3261a9508964e5be33ade 100644 (file)
@@ -20,9 +20,8 @@ PRIVATE>
 
 : in? ( key set -- ? )
     check-interval-set array>>
-    over dupd [ >=< ] curry search drop [
-        dup even? [ dup 1 + ] [ [ 1 - ] keep ] if rot
-        [ nth-unsafe ] curry bi@ 1 - between?
+    dupd [ <=> ] with search swap [
+        even? [ >= ] [ 1 - <= ] if
     ] [ 2drop f ] if* ;
 
 <PRIVATE