]> gitweb.factorcode.org Git - factor.git/commitdiff
make monotonic-slice compile
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 10 Jan 2009 01:04:10 +0000 (19:04 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 10 Jan 2009 01:04:10 +0000 (19:04 -0600)
basis/splitting/monotonic/monotonic-tests.factor
basis/splitting/monotonic/monotonic.factor

index 7bf9a38e8a713d7a57af67eafe40c4f09856a220..2b44f423942ea10babd8c711d273434b0cc7e692 100644 (file)
@@ -15,6 +15,8 @@ USING: tools.test math arrays kernel sequences ;
 [ { { 1 } } ]
 [ { 1 } [ = ] slice monotonic-slice [ >array ] map ] unit-test
 
+[ { 1 } [ = ] slice monotonic-slice ] must-infer
+
 [ t ]
 [ { 1 1 1 2 2 3 3 4 } [ = ] slice monotonic-slice [ slice? ] all? ] unit-test
 
index e39bba25ab717aa0416c19f74d4425556c0a02f2..2e2ac74e3053673a0ae4f9a2cdd1cbf68208eb52 100644 (file)
@@ -24,13 +24,15 @@ PRIVATE>
 <PRIVATE
 
 : (monotonic-slice) ( seq quot class -- slices )
-    -rot
-    dupd '[
-        [ length ] [ ] [ <circular> 1 over change-circular-start ] tri
-        [ @ not [ , ] [ drop ] if ] 3each
-    ] { } make
-    dup empty? [ over length 1- prefix ] when -1 prefix 2 clump
-    [ first2 [ 1+ ] bi@ rot roll boa ] with with map ; inline
+    [
+        dupd '[
+            [ length ] [ ] [ <circular> 1 over change-circular-start ] tri
+            [ @ not [ , ] [ drop ] if ] 3each
+        ] { } make
+        dup empty? [ over length 1- prefix ] when -1 prefix 2 clump
+        swap
+    ] dip
+    '[ first2 [ 1+ ] bi@ _ _ boa ] map ; inline
 
 PRIVATE>
 
@@ -39,7 +41,7 @@ PRIVATE>
         { 0 [ 2drop ] }
         { 1 [ nip [ 0 1 rot ] dip boa 1array ] }
         [ drop (monotonic-slice) ]
-    } case ;
+    } case ; inline
 
 TUPLE: downward-slice < slice ;
 TUPLE: stable-slice < slice ;