]> gitweb.factorcode.org Git - factor.git/commitdiff
classes.algebra: change (flatten-class) to use arrays.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 24 Oct 2019 21:12:26 +0000 (14:12 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 24 Oct 2019 21:12:26 +0000 (14:12 -0700)
core/classes/algebra/algebra.factor
core/classes/builtin/builtin.factor
core/classes/intersection/intersection.factor
core/classes/tuple/tuple.factor
core/classes/union/union.factor
core/generic/single/single.factor

index 8b92932adce4f6e4edf15a7f8eda75d7a99086c8..a01bc3ff54c13041a92dc3b88bf7063e039cbbfa 100644 (file)
@@ -288,5 +288,5 @@ ERROR: topological-sort-failed ;
         [ ] [ [ class<= ] most ] map-reduce
     ] if-empty ;
 
-: flatten-class ( class -- assoc )
-    [ (flatten-class) ] H{ } make ;
+: flatten-class ( class -- seq )
+    [ (flatten-class) ] { } make members ;
index 72178f62f2728bf4072c956e81a41e692098ea25..74c868a17a96482d73b10a912f6baa2d690ae8d5 100644 (file)
@@ -26,7 +26,7 @@ M: builtin-class rank-class drop 0 ;
 
 M: builtin-class instance? [ tag ] [ class>type ] bi* eq? ;
 
-M: builtin-class (flatten-class) dup ,, ;
+M: builtin-class (flatten-class) , ;
 
 M: builtin-class (classes-intersect?) eq? ;
 
index 1e423a472f84d9a4e9ddf70495ef54d1266fb0e3..bd18ca61b65c139c3c8b8e4e3c4d886d123b729d 100644 (file)
@@ -46,9 +46,9 @@ M: intersection-class (flatten-class)
 
 M: anonymous-intersection (flatten-class)
     participants>> [ full-cover ] [
-        [ flatten-class keys ]
+        [ flatten-class ]
         [ intersect-flattened-classes ] map-reduce
-        [ dup ,, ] each
+        %
     ] if-empty ;
 
 M: anonymous-intersection class-name
index d7362c83c18465cdcc3ac72c268fb45f94ad27d7..ec6fc5f76cf26525ec47d40b06a0f1a4de7773fe 100644 (file)
@@ -358,7 +358,7 @@ M: tuple-class rank-class drop 1 ;
 M: tuple-class instance?
     dup echelon-of layout-class-offset tuple-instance? ;
 
-M: tuple-class (flatten-class) dup ,, ;
+M: tuple-class (flatten-class) , ;
 
 M: tuple-class (classes-intersect?)
     {
index 05bb9bee3d24f22d7d9eabc8b9eb44ffdaf77c86..b90d756bce6ca3043bc044f116bca13b46cb6972 100644 (file)
@@ -22,8 +22,7 @@ M: class union-of-builtins?
     drop f ;
 
 : fast-union-mask ( class -- n )
-    [ 0 ] dip flatten-class
-    [ drop class>type 2^ bitor ] assoc-each ;
+    flatten-class 0 [ class>type 2^ bitor ] each ;
 
 : empty-union-predicate-quot ( class -- quot )
     drop [ drop f ] ;
index bef4a22765e1e0e7fef40bfa9b16f1057f0e85ac..bc255e72ee076952c1b76e90cdec0ccf24ce98c1 100644 (file)
@@ -81,8 +81,7 @@ C: <predicate-engine> predicate-engine
     ] change-at ;
 
 : flatten-method ( method class assoc -- )
-    over flatten-class keys
-    [ swap push-method ] 2with with each ;
+    over flatten-class [ swap push-method ] 2with with each ;
 
 : flatten-methods ( assoc -- assoc' )
     H{ } clone [ [ swapd flatten-method ] curry assoc-each ] keep ;