]> gitweb.factorcode.org Git - factor.git/commitdiff
more removals of unnecessary >list calls
authorSlava Pestov <slava@factorcode.org>
Sat, 23 Jul 2005 03:21:50 +0000 (03:21 +0000)
committerSlava Pestov <slava@factorcode.org>
Sat, 23 Jul 2005 03:21:50 +0000 (03:21 +0000)
TODO.FACTOR.txt
library/collections/sequences-epilogue.factor
library/compiler/optimizer.factor
library/inference/partial-eval.factor
library/test/math/matrices.factor
library/test/sequences.factor
library/test/strings.factor
library/ui/presentations.factor

index 2a9d1e37230b30fe88a1a35d67138e245f610a96..0f483351c99f85ade5f347a2d47c63615554dc44 100644 (file)
@@ -1,5 +1,3 @@
-- timeouts broken on unix\r
-\r
 + ui:\r
 \r
 - fix listener prompt display after presentation commands invoked\r
index 774b0d6edcd2b2746c8879aa462e1665ddbca843..f2aa932e3d1d2910da62f6e6644d00c0522c215b 100644 (file)
@@ -164,13 +164,13 @@ M: object >list ( seq -- list ) dup length 0 rot (>list) ;
     #! Return a new sequence of the same type as s1.
     rot [ [ rot nappend ] keep swap nappend ] immutable ;
 
-M: f concat ;
-
-M: cons concat
-    unswons [ swap [ nappend ] each-with ] immutable ;
-
-M: object concat
-    >list concat ;
+: concat ( seq -- seq )
+    #! Append a sequence of sequences together. The new sequence
+    #! has the same type as the first sequence.
+    dup empty? [
+        [ 1024 <vector> swap [ dupd nappend ] each ] keep
+        first like
+    ] unless ;
 
 M: object peek ( sequence -- element )
     #! Get value at end of sequence.
index 6a6d98d855c98eb3089236dddf2e3726ab0d6e99..682300ae262993d3ebdd1d87bac65be0561cb8e6 100644 (file)
@@ -196,7 +196,7 @@ M: #values can-kill* ( literal node -- ? )
     ] ifte ;
 
 : branch-values ( branches -- )
-    [ last-node node-in-d >list ] map
+    [ last-node node-in-d ] map
     unify-lengths seq-transpose branch-returns set ;
 
 : can-kill-branches? ( literal node -- ? )
index 606aa3948ad6046c3a9b45d730c376237f742395..850c0a7212bf4cd87c88a6e39dda660cd2e234ad 100644 (file)
@@ -5,11 +5,8 @@ USING: generic interpreter kernel lists math namespaces
 sequences words ;
 
 : literal-inputs? ( in stack -- )
-    tail-slice* dup >list [ safe-literal? ] all? [
-        length #drop node, t
-    ] [
-        drop f
-    ] ifte ;
+    tail-slice* dup [ safe-literal? ] all?
+    [ length #drop node, t ] [ drop f ] ifte ;
 
 : literal-inputs ( out stack -- )
     tail-slice* [ literal-value ] nmap ;
index 48e30d09128dfc8733c68244eb451e02b4f6d2ec..cf9a1978a0d87c4ecef6e10d0cbe5e58360d5a76 100644 (file)
@@ -1,5 +1,6 @@
 IN: temporary
-USING: kernel lists math matrices namespaces sequences test ;
+USING: kernel lists math matrices namespaces sequences test
+vectors ;
 
 [ [ [ 1 4 ] [ 2 5 ] [ 3 6 ] ] ]
 [ M[ [ 1 4 ] [ 2 5 ] [ 3 6 ] ]M row-list ] unit-test
@@ -131,10 +132,10 @@ unit-test
 ] unit-test
 
 [
-    [ [ 7 ] [ 4 8 ] [ 1 5 9 ] [ 2 6 ] [ 3 ] ]
+    [ { 7 } { 4 8 } { 1 5 9 } { 2 6 } { 3 } ]
 ] [
     M[ [ 1 2 3 ] [ 4 5 6 ] [ 7 8 9 ] ]M
-    5 [ 2 - swap <diagonal> ] project-with [ >list ] map
+    5 [ 2 - swap <diagonal> ] project-with [ >vector ] map
 ] unit-test
 
 [ { t t t } ]
index 2d53dcd7eb5d73a11d2d62ade1934b63994383ae..abbe3cd98b9939080380c26ae09189bc4b392604 100644 (file)
@@ -1,11 +1,11 @@
 IN: temporary
 USING: kernel lists math sequences strings test vectors ;
 
-[ [ 1 2 3 4 ] ] [ 1 5 <range> >list ] unit-test
+[ { 1 2 3 4 } ] [ 1 5 <range> >vector ] unit-test
 [ 3 ] [ 1 4 <range> length ] unit-test
-[ [ 4 3 2 1 ] ] [ 4 0 <range> >list ] unit-test
+[ { 4 3 2 1 } ] [ 4 0 <range> >vector ] unit-test
 [ 2 ] [ 1 3 { 1 2 3 4 } <slice> length ] unit-test
-[ [ 2 3 ] ] [ 1 3 { 1 2 3 4 } <slice> >list ] unit-test
+[ { 2 3 } ] [ 1 3 { 1 2 3 4 } <slice> >vector ] unit-test
 [ { 4 5 } ] [ 2 { 1 2 3 4 5 } tail-slice* >vector ] unit-test
 [ { 1 2 } { 3 4 } ] [ 2 { 1 2 3 4 } cut ] unit-test
 [ { 1 2 } { 4 5 } ] [ 2 { 1 2 3 4 5 } cut* ] unit-test
index 24f600ce4a37cd15568a278d600a358e3e548ac3..f0c95570d29c05c17fcb29ef89bb05b603410e2b 100644 (file)
@@ -1,4 +1,5 @@
 IN: temporary
+USING: vectors ;
 USE: errors
 USE: kernel
 USE: math
@@ -96,4 +97,4 @@ unit-test
 [ 1 "" nth ] unit-test-fails
 [ -6 "hello" nth ] unit-test-fails
 
-[ t ] [ "hello world" dup >list >string = ] unit-test 
+[ t ] [ "hello world" dup >vector >string = ] unit-test 
index 3710bc4607188c1ccd8c0fa235bf550c7b923f77..9310b05d4b4c0c98decbfeb445ce520737db7b0f 100644 (file)
@@ -11,8 +11,8 @@ global [ 100 <vector> commands set ] bind
 : define-command ( class name quot -- )
     3list commands get push ;
 
-: applicable ( object -- list )
-    commands get >list [ car call ] subset-with ;
+: applicable ( object -- seq )
+    commands get [ car call ] subset-with ;
 
 : command-quot ( presented quot -- quot )
     [ swap literal, % ] make-list