diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 2a9d1e3723..0f483351c9 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,5 +1,3 @@ -- timeouts broken on unix - + ui: - fix listener prompt display after presentation commands invoked diff --git a/library/collections/sequences-epilogue.factor b/library/collections/sequences-epilogue.factor index 774b0d6edc..f2aa932e3d 100644 --- a/library/collections/sequences-epilogue.factor +++ b/library/collections/sequences-epilogue.factor @@ -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 swap [ dupd nappend ] each ] keep + first like + ] unless ; M: object peek ( sequence -- element ) #! Get value at end of sequence. diff --git a/library/compiler/optimizer.factor b/library/compiler/optimizer.factor index 6a6d98d855..682300ae26 100644 --- a/library/compiler/optimizer.factor +++ b/library/compiler/optimizer.factor @@ -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 -- ? ) diff --git a/library/inference/partial-eval.factor b/library/inference/partial-eval.factor index 606aa3948a..850c0a7212 100644 --- a/library/inference/partial-eval.factor +++ b/library/inference/partial-eval.factor @@ -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 ; diff --git a/library/test/math/matrices.factor b/library/test/math/matrices.factor index 48e30d0912..cf9a1978a0 100644 --- a/library/test/math/matrices.factor +++ b/library/test/math/matrices.factor @@ -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 ] project-with [ >list ] map + 5 [ 2 - swap ] project-with [ >vector ] map ] unit-test [ { t t t } ] diff --git a/library/test/sequences.factor b/library/test/sequences.factor index 2d53dcd7eb..abbe3cd98b 100644 --- a/library/test/sequences.factor +++ b/library/test/sequences.factor @@ -1,11 +1,11 @@ IN: temporary USING: kernel lists math sequences strings test vectors ; -[ [ 1 2 3 4 ] ] [ 1 5 >list ] unit-test +[ { 1 2 3 4 } ] [ 1 5 >vector ] unit-test [ 3 ] [ 1 4 length ] unit-test -[ [ 4 3 2 1 ] ] [ 4 0 >list ] unit-test +[ { 4 3 2 1 } ] [ 4 0 >vector ] unit-test [ 2 ] [ 1 3 { 1 2 3 4 } length ] unit-test -[ [ 2 3 ] ] [ 1 3 { 1 2 3 4 } >list ] unit-test +[ { 2 3 } ] [ 1 3 { 1 2 3 4 } >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 diff --git a/library/test/strings.factor b/library/test/strings.factor index 24f600ce4a..f0c95570d2 100644 --- a/library/test/strings.factor +++ b/library/test/strings.factor @@ -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 diff --git a/library/ui/presentations.factor b/library/ui/presentations.factor index 3710bc4607..9310b05d4b 100644 --- a/library/ui/presentations.factor +++ b/library/ui/presentations.factor @@ -11,8 +11,8 @@ global [ 100 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