]> gitweb.factorcode.org Git - factor.git/commitdiff
sorting: move push-unsafe and push-all-unsafe to growable.private.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 23 Mar 2013 21:16:44 +0000 (14:16 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 23 Mar 2013 21:16:44 +0000 (14:16 -0700)
core/growable/growable.factor
core/sorting/sorting.factor

index 8903187fbd06fbeafa94ee1ebda26eb709f41b37..35007b8a0c824d83fc7152f02dd481f80ba85f61 100644 (file)
@@ -13,6 +13,18 @@ M: growable length length>> ; inline
 M: growable nth-unsafe underlying>> nth-unsafe ; inline
 M: growable set-nth-unsafe underlying>> set-nth-unsafe ; inline
 
+<PRIVATE
+
+: push-unsafe ( elt seq -- )
+    [ length ] keep
+    [ set-nth-unsafe ] [ [ 1 + ] dip length<< ] 2bi ; inline
+
+: push-all-unsafe ( from to src dst -- )
+    [ over - swap ] 2dip [ pick ] dip [ length ] keep
+    [ [ + ] dip length<< ] 2keep <copy> (copy) drop ; inline
+
+PRIVATE>
+
 : capacity ( seq -- n ) underlying>> length ; inline
 
 : expand ( len seq -- )
index 37407214f7a59e5d19740cb17ffa08fd9c93d17f..adc74357c6c91d0ad8bf5efdfdf4263a75024fdd 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2005, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs kernel math math.order sequences
-sequences.private vectors ;
+USING: accessors arrays assocs growable.private kernel math
+math.order sequences sequences.private vectors ;
 IN: sorting
 
 ! Optimized merge-sort:
@@ -23,14 +23,6 @@ TUPLE: merge
 { from2  array-capacity }
 { to2    array-capacity } ;
 
-: push-unsafe ( elt seq -- )
-    [ length ] keep
-    [ set-nth-unsafe ] [ [ 1 + ] dip length<< ] 2bi ; inline
-
-: push-all-unsafe ( from to src dst -- )
-    [ over - swap ] 2dip [ pick ] dip [ length ] keep
-    [ [ + ] dip length<< ] 2keep <copy> (copy) drop ; inline
-
 : l-elt ( merge -- elt ) [ from1>> ] [ seq>> ] bi nth-unsafe ; inline
 
 : r-elt ( merge -- elt ) [ from2>> ] [ seq>> ] bi nth-unsafe ; inline