]> gitweb.factorcode.org Git - factor.git/commitdiff
combinators.smart: Add cleave>array.
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 17 Sep 2012 00:32:27 +0000 (17:32 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 17 Sep 2012 00:32:27 +0000 (17:32 -0700)
basis/combinators/smart/smart.factor
basis/regexp/classes/classes.factor

index e808f3e32eba5408dbece8683911a691d42040fb..81528c1823b750bc345290bc17c55ecd67eeb5c2 100644 (file)
@@ -3,7 +3,8 @@
 USING: accessors arrays effects fry generalizations kernel
 macros math math.order sequences sequences.generalizations
 stack-checker stack-checker.backend stack-checker.errors
-stack-checker.values stack-checker.visitor words memoize ;
+stack-checker.values stack-checker.visitor words memoize
+combinators ;
 IN: combinators.smart
 
 GENERIC: infer-known* ( known -- effect )
@@ -65,6 +66,9 @@ M: object infer-known* drop f ;
 
 : output>array ( quot -- array )
     { } output>sequence ; inline
+    
+: cleave>array ( x seq -- array )
+    '[ _ cleave ] output>array ; inline
 
 : input<sequence ( seq quot -- )
     [ inputs firstn ] [ call ] bi ; inline
index db420839e16f3b889462df795278cc495e868e5c..58f08ef793525041879bd6464896c12171ced9ad 100644 (file)
@@ -168,17 +168,15 @@ TUPLE: class-partition integers not-integers simples not-simples and or other ;
     class-partition boa ;
 
 : class-partition>sequence ( class-partition -- seq )
-    [
-        {
-            [ integers>> ]
-            [ not-integers>> ]
-            [ simples>> ]
-            [ not-simples>> ]
-            [ and>> ]
-            [ or>> ]
-            [ other>> ]
-        } cleave
-    ] output>array concat ;
+    {
+        [ integers>> ]
+        [ not-integers>> ]
+        [ simples>> ]
+        [ not-simples>> ]
+        [ and>> ]
+        [ or>> ]
+        [ other>> ]
+    } cleave>array concat ;
 
 : repartition ( partition -- partition' )
     ! This could be made more efficient; only and and or are effected