From: Doug Coleman Date: Thu, 21 Jul 2022 06:52:08 +0000 (-0500) Subject: factor: use new words X-Git-Tag: 0.99~1308 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=e623022a0c3f8d2fa2cfd522f47ae4ac0977e7f7 factor: use new words --- diff --git a/basis/alien/libraries/finder/linux/linux-tests.factor b/basis/alien/libraries/finder/linux/linux-tests.factor index 261ecaadb5..b26947f9c9 100644 --- a/basis/alien/libraries/finder/linux/linux-tests.factor +++ b/basis/alien/libraries/finder/linux/linux-tests.factor @@ -1,4 +1,4 @@ USING: alien.libraries.finder sequences tools.test ; -{ t } [ "libm.so" "m" find-library subseq? ] unit-test -{ t } [ "libc.so" "c" find-library subseq? ] unit-test +{ t } [ "m" find-library "libm.so" find-subseq? ] unit-test +{ t } [ "c" find-library "libc.so" find-subseq? ] unit-test diff --git a/basis/alien/libraries/finder/linux/linux.factor b/basis/alien/libraries/finder/linux/linux.factor index 835cc54666..cedd58cb84 100644 --- a/basis/alien/libraries/finder/linux/linux.factor +++ b/basis/alien/libraries/finder/linux/linux.factor @@ -20,7 +20,7 @@ CONSTANT: mach-map { [ " " split1 [ "()" in? ] trim "," split [ [ unicode:blank? ] trim ] map - [ ": Linux" swap subseq? ] reject + [ ": Linux" find-subseq? ] reject ] dip 3array ] map ; @@ -50,7 +50,7 @@ CONSTANT: mach-map { "ld" , "-t" , ":" split [ "-L" , , ] each "-o" , "/dev/null" , "-l" name append , ] { } make utf8 [ read-lines ] with-process-reader* 2drop - "lib" name append '[ _ swap subseq? ] find nip + "lib" name append '[ _ find-subseq? ] find nip ] [ f ] if* ; PRIVATE> diff --git a/basis/alien/libraries/finder/macosx/macosx-tests.factor b/basis/alien/libraries/finder/macosx/macosx-tests.factor index 83d65e8f34..a37425ded4 100644 --- a/basis/alien/libraries/finder/macosx/macosx-tests.factor +++ b/basis/alien/libraries/finder/macosx/macosx-tests.factor @@ -41,7 +41,7 @@ alien.libraries.finder.macosx.private sequences tools.test ; } [ dyld-find ] map ] unit-test -{ t } [ "libm.dylib" "m" find-library subseq? ] unit-test -{ t } [ "libc.dylib" "c" find-library subseq? ] unit-test -{ t } [ "libbz2.dylib" "bz2" find-library subseq? ] unit-test -{ t } [ "AGL.framework" "AGL" find-library subseq? ] unit-test +{ t } [ "m" find-library "libm.dylib" find-subseq? ] unit-test +{ t } [ "c" find-library "libc.dylib" find-subseq? ] unit-test +{ t } [ "bz2" find-library "libbz2.dylib" find-subseq? ] unit-test +{ t } [ "AGL" find-library "AGL.framework" find-subseq? ] unit-test diff --git a/basis/alien/libraries/finder/macosx/macosx.factor b/basis/alien/libraries/finder/macosx/macosx.factor index 0ff1c8457a..d5913c85de 100644 --- a/basis/alien/libraries/finder/macosx/macosx.factor +++ b/basis/alien/libraries/finder/macosx/macosx.factor @@ -130,7 +130,7 @@ PRIVATE> : framework-find ( name -- path ) dup dyld-find [ nip ] [ - ".framework" over subseq-start [ + dup ".framework" find-subseq [ dupd head ] [ [ ".framework" append ] keep diff --git a/basis/alien/libraries/finder/windows/windows-tests.factor b/basis/alien/libraries/finder/windows/windows-tests.factor index d0fb21fa2a..741f4375cb 100644 --- a/basis/alien/libraries/finder/windows/windows-tests.factor +++ b/basis/alien/libraries/finder/windows/windows-tests.factor @@ -1,3 +1,3 @@ USING: alien.libraries.finder sequences tools.test ; -{ t } [ "kernel32.dll" "kernel32" find-library subseq? ] unit-test +{ t } [ "kernel32" find-library "kernel32.dll" find-subseq? ] unit-test diff --git a/basis/base64/base64.factor b/basis/base64/base64.factor index a85768aafe..38016ed417 100644 --- a/basis/base64/base64.factor +++ b/basis/base64/base64.factor @@ -77,7 +77,7 @@ PRIVATE> string string>number + member-eq? split harvest sift cut cut-slice subseq-start find-subseq + index clone set-at reverse push-all class-of number>string string>number like clone-like } compile-unoptimized diff --git a/basis/cocoa/application/application.factor b/basis/cocoa/application/application.factor index 86cd177916..9b485af8a0 100644 --- a/basis/cocoa/application/application.factor +++ b/basis/cocoa/application/application.factor @@ -40,9 +40,8 @@ FUNCTION: void NSBeep ( ) : running.app? ( -- ? ) ! Test if we're running a .app. - ".app" NSBundle -> mainBundle -> bundlePath CF>string - subseq? ; + ".app" tail? ; : assert.app ( message -- ) running.app? [ diff --git a/basis/compiler/cfg/builder/builder-tests.factor b/basis/compiler/cfg/builder/builder-tests.factor index f0636006d3..0815040fd7 100644 --- a/basis/compiler/cfg/builder/builder-tests.factor +++ b/basis/compiler/cfg/builder/builder-tests.factor @@ -90,7 +90,7 @@ IN: compiler.cfg.builder.tests [ { array } declare dup 1 slot [ 1 slot ] when ] [ [ dup more? ] [ dup ] produce ] [ vector new over test-case-1 [ test-case-2 ] [ ] if ] - [ [ [ nth-unsafe ".." = 0 ] dip set-nth-unsafe ] 2curry (each-integer) ] + [ [ [ nth-unsafe ".." = 0 ] dip set-nth-unsafe ] 2curry each-integer-from ] [ { fixnum sbuf } declare 2dup 3 slot fixnum> [ over 3 fixnum* over dup [ 2 slot resize-string ] dip 2 set-slot diff --git a/basis/compiler/cfg/checker/checker.factor b/basis/compiler/cfg/checker/checker.factor index 23c5b25b6d..0330d85b67 100644 --- a/basis/compiler/cfg/checker/checker.factor +++ b/basis/compiler/cfg/checker/checker.factor @@ -6,7 +6,7 @@ IN: compiler.cfg.checker ERROR: bad-successors ; : check-successors ( bb -- ) - dup successors>> [ predecessors>> member-eq? ] with all? + dup successors>> '[ _ predecessors>> member-eq-of? ] all? [ bad-successors ] unless ; : check-cfg ( cfg -- ) diff --git a/basis/compiler/cfg/stacks/local/local-tests.factor b/basis/compiler/cfg/stacks/local/local-tests.factor index 83135d186d..d12de43706 100644 --- a/basis/compiler/cfg/stacks/local/local-tests.factor +++ b/basis/compiler/cfg/stacks/local/local-tests.factor @@ -178,4 +178,4 @@ IN: compiler.cfg.stacks.local.tests my-new-key4 set-slot ] - curry (each-integer) ; + curry each-integer-from ; diff --git a/basis/compiler/tree/dead-code/dead-code-tests.factor b/basis/compiler/tree/dead-code/dead-code-tests.factor index 8812802b4c..07394ecede 100644 --- a/basis/compiler/tree/dead-code/dead-code-tests.factor +++ b/basis/compiler/tree/dead-code/dead-code-tests.factor @@ -167,7 +167,7 @@ IN: compiler.tree.dead-code.tests { } [ [ call-recursive-dce-5 swap ] optimize-quot drop ] unit-test -{ } [ [ [ 0 -rot set-nth-unsafe ] curry (each-integer) ] optimize-quot drop ] unit-test +{ } [ [ [ 0 -rot set-nth-unsafe ] curry each-integer-from ] optimize-quot drop ] unit-test : call-recursive-dce-6 ( i quot: ( ..a -- ..b ) -- i ) dup call [ drop ] [ call-recursive-dce-6 ] if ; inline recursive diff --git a/basis/compiler/tree/propagation/propagation-tests.factor b/basis/compiler/tree/propagation/propagation-tests.factor index 52016efa87..b346b36736 100644 --- a/basis/compiler/tree/propagation/propagation-tests.factor +++ b/basis/compiler/tree/propagation/propagation-tests.factor @@ -726,7 +726,7 @@ TUPLE: mixed-mutable-immutable { x integer } { y sequence read-only } ; { } [ [ [ ] [ ] compose curry call ] final-info drop ] unit-test { V{ } } [ - [ [ drop ] [ drop ] compose curry (each-integer) ] final-classes + [ [ drop ] [ drop ] compose curry each-integer-from ] final-classes ] unit-test GENERIC: iterate ( obj -- next-obj ? ) diff --git a/basis/compiler/tree/recursive/recursive-tests.factor b/basis/compiler/tree/recursive/recursive-tests.factor index ce69216cfc..ba029034e7 100644 --- a/basis/compiler/tree/recursive/recursive-tests.factor +++ b/basis/compiler/tree/recursive/recursive-tests.factor @@ -51,7 +51,7 @@ IN: compiler.tree.recursive.tests { t } [ [ [ loop-test-1 ] each ] build-tree analyze-recursive - \ (each-integer) label-is-loop? + \ each-integer-from label-is-loop? ] unit-test : loop-test-2 ( a b -- a' ) @@ -175,7 +175,7 @@ DEFER: a'' { t } [ [ 10 [ [ drop ] each-integer ] loop-in-non-loop ] build-tree analyze-recursive - \ (each-integer) label-is-loop? + \ each-integer-from label-is-loop? ] unit-test DEFER: a''' diff --git a/basis/db/sqlite/sqlite.factor b/basis/db/sqlite/sqlite.factor index b581a50058..046e662f5c 100644 --- a/basis/db/sqlite/sqlite.factor +++ b/basis/db/sqlite/sqlite.factor @@ -260,7 +260,7 @@ M: sqlite-db-connection persistent-table "sql-spec" get modifiers>> [ +not-null+ = ] none? ; : delete-cascade? ( -- ? ) - "sql-spec" get modifiers>> { +on-delete+ +cascade+ } swap subseq? ; + "sql-spec" get modifiers>> { +on-delete+ +cascade+ } find-subseq? ; : sqlite-trigger, ( string -- ) { } { } 3, ; diff --git a/basis/dns/dns.factor b/basis/dns/dns.factor index c6bcfb37ad..2cb75d9eb8 100644 --- a/basis/dns/dns.factor +++ b/basis/dns/dns.factor @@ -58,7 +58,7 @@ SYMBOL: dns-servers ERROR: domain-name-contains-empty-label domain ; : check-domain-name ( domain -- domain ) - ".." over subseq? [ domain-name-contains-empty-label ] when ; + dup ".." find-subseq? [ domain-name-contains-empty-label ] when ; : >dotted ( domain -- domain' ) dup "." tail? [ "." append ] unless ; diff --git a/basis/fixups/fixups.factor b/basis/fixups/fixups.factor index d7c70b6634..77b3ca7458 100644 --- a/basis/fixups/fixups.factor +++ b/basis/fixups/fixups.factor @@ -42,6 +42,9 @@ CONSTANT: word-renames { { "git-checkout-existing-branch" { "git-checkout-existing" "0.99" } } { "git-checkout-existing-branch*" { "git-checkout-existing*" "0.99" } } { "tags" { "chloe-tags" "0.99" } } + { "(each-integer)" { "each-integer-from" "0.99" } } + { "(find-integer)" { "find-integer-from" "0.99" } } + { "(all-integers?)" { "all-integers-from?" "0.99" } } } : compute-assoc-fixups ( continuation name assoc -- seq ) diff --git a/basis/grouping/grouping.factor b/basis/grouping/grouping.factor index 49890180e0..43916ab8d9 100644 --- a/basis/grouping/grouping.factor +++ b/basis/grouping/grouping.factor @@ -75,7 +75,7 @@ PRIVATE> [ first2-unsafe ] dip call ] [ [ [ first-unsafe 1 ] [ setup-each [ + ] 2dip ] bi ] dip - '[ @ _ keep swap ] (all-integers?) nip + '[ @ _ keep swap ] all-integers-from? nip ] if ] if ; inline diff --git a/basis/help/html/html.factor b/basis/help/html/html.factor index b5ee48c8eb..fd885b22cf 100644 --- a/basis/help/html/html.factor +++ b/basis/help/html/html.factor @@ -140,17 +140,17 @@ M: pathname url-of " white-space: pre-wrap; line-height: 125%;" append ] re-replace-with - { "font-family: monospace;" "background-color:" } [ over subseq? ] all? [ - " margin: 10px 0px;" append - ] when + { "font-family: monospace;" "background-color:" } [ find-subseq? ] with all?[ + " margin: 10px 0px;" append + ] when - { "border:" "background-color:" } [ over subseq? ] all? [ + dup { "border:" "background-color:" } [ find-subseq? ] with all? [ " border-radius: 5px;" append ] when ; : fix-help-header ( classes -- classes ) dup [ - [ ".a" head? ] [ "#f4efd9;" swap subseq? ] bi and + [ ".a" head? ] [ "#f4efd9;" find-subseq? ] bi and ] find [ "padding: 10px;" "padding: 0px;" replace "background-color: #f4efd9;" "background-color: white;" replace @@ -188,7 +188,7 @@ M: pathname url-of ] re-replace-with ] map " " join "{ " " }" surround ] re-replace-with " " prepend - "{ }" over subseq? [ drop f ] when + dup "{ }" find-subseq? [ drop f ] when ] map harvest append "}" suffix ; : css-classes ( classes -- stylesheet ) @@ -215,7 +215,7 @@ M: pathname url-of ] each classes sort-values css-classes body ; : retina-image ( path -- path' ) - "@2x" over subseq? [ "." split1-last "@2x." glue ] unless ; + dup "@2x" find-subseq? [ "." split1-last "@2x." glue ] unless ; : ?copy-file ( from to -- ) dup file-exists? [ 2drop ] [ copy-file ] if ; diff --git a/basis/help/lint/checks/checks.factor b/basis/help/lint/checks/checks.factor index 6c994e0101..fc2b6b9406 100644 --- a/basis/help/lint/checks/checks.factor +++ b/basis/help/lint/checks/checks.factor @@ -152,7 +152,7 @@ SYMBOL: vocab-articles simple-lint-error ] when ] [ - " " swap subseq? [ + " " find-subseq? [ "Paragraph text should not contain double spaces" simple-lint-error ] when diff --git a/basis/help/lint/spaces/spaces.factor b/basis/help/lint/spaces/spaces.factor index 7032f7bd22..3419b029d5 100644 --- a/basis/help/lint/spaces/spaces.factor +++ b/basis/help/lint/spaces/spaces.factor @@ -18,7 +18,7 @@ IN: help.lint.spaces first [ { [ CHAR: space = ] [ CHAR: " = ] } 1|| ] trim-head - " " swap subseq? + " " find-subseq? ] filter [ drop ] [ swap . diff --git a/basis/help/search/search.factor b/basis/help/search/search.factor index 3ed9b2f08b..3910358025 100644 --- a/basis/help/search/search.factor +++ b/basis/help/search/search.factor @@ -37,7 +37,7 @@ MEMO: article-words ( name -- words ) search-words [ { } ] [ [ all-articles ] dip dup length 1 > [ - '[ article-words _ swap subseq? ] filter + '[ article-words _ find-subseq? ] filter ] [ first '[ article-words [ _ head? ] any? ] filter ] if diff --git a/basis/html/templates/fhtml/fhtml.factor b/basis/html/templates/fhtml/fhtml.factor index cac7b39f0b..40189add6d 100644 --- a/basis/html/templates/fhtml/fhtml.factor +++ b/basis/html/templates/fhtml/fhtml.factor @@ -23,7 +23,7 @@ M: template-lexer skip-word DEFER: <% delimiter : check-<% ( lexer -- col ) - "<%" swap [ line-text>> ] [ column>> ] bi subseq-start-from ; + [ column>> ] [ line-text>> ] bi "<%" find-subseq-from ; : found-<% ( accum lexer col -- accum ) [ diff --git a/basis/http/client/client-tests.factor b/basis/http/client/client-tests.factor index d139ad7b6a..aec8f2041f 100644 --- a/basis/http/client/client-tests.factor +++ b/basis/http/client/client-tests.factor @@ -48,8 +48,8 @@ IN: http.client.tests ! hit the velox.ch website. ! { t } [ ! "https://alice.sni.velox.ch" http-get nip - ! [ "Great!" swap subseq? ] - ! [ "TLS SNI Test Site: alice.sni.velox.ch" swap subseq? ] bi and + ! [ "Great!" find-subseq? ] + ! [ "TLS SNI Test Site: alice.sni.velox.ch" find-subseq? ] bi and ! ] unit-test { t } [ diff --git a/basis/io/buffers/buffers.factor b/basis/io/buffers/buffers.factor index 72d7f4c474..16fd743976 100644 --- a/basis/io/buffers/buffers.factor +++ b/basis/io/buffers/buffers.factor @@ -80,7 +80,7 @@ TYPED: buffer-find ( seps buffer: buffer -- n/f ) [ swap [ [ pos>> ] [ fill>> ] [ ptr>> ] tri ] dip [ swap alien-unsigned-1 ] [ member-eq? ] bi-curry* - compose (find-integer) + compose find-integer-from ] [ [ pos>> - ] curry [ f ] if* ] bi ; inline diff --git a/basis/math/matrices/matrices.factor b/basis/math/matrices/matrices.factor index 68cbfa4414..cfbee2962c 100644 --- a/basis/math/matrices/matrices.factor +++ b/basis/math/matrices/matrices.factor @@ -122,7 +122,7 @@ ALIAS: transpose flip : unshaped-cols-iota ( matrix -- cols-iota ) [ first-unsafe length ] keep - [ length min ] 1 (each-from) (each-integer) ; inline + [ length min ] 1 (each-from) each-integer-from ; inline : generic-anti-transpose-unsafe ( cols-iota matrix -- newmatrix ) [ [ nth-end-unsafe ] with { } map-as ] curry { } map-as ; inline diff --git a/basis/multiline/multiline.factor b/basis/multiline/multiline.factor index d984095dfe..bc5e8a4555 100644 --- a/basis/multiline/multiline.factor +++ b/basis/multiline/multiline.factor @@ -41,7 +41,7 @@ SYNTAX: STRING: :: (scan-multiline-string) ( i end lexer -- j ) lexer line-text>> :> text lexer still-parsing? [ - end text i subseq-start-from [| j | + i text end find-subseq-from [| j | i j text subseq % j end length + ] [ text i short tail % CHAR: \n , diff --git a/basis/quoted-printable/quoted-printable-tests.factor b/basis/quoted-printable/quoted-printable-tests.factor index b500212ce1..f57f2f0a1a 100644 --- a/basis/quoted-printable/quoted-printable-tests.factor +++ b/basis/quoted-printable/quoted-printable-tests.factor @@ -23,8 +23,8 @@ and we didn't know hów tö do thât" latin2 encode >quoted ] unit-test : message ( -- str ) 55 [ "hello" ] replicate concat ; -{ f } [ message >quoted "=\r\n" swap subseq? ] unit-test +{ f } [ message >quoted "=\r\n" find-subseq? ] unit-test { 1 } [ message >quoted split-lines length ] unit-test -{ t } [ message >quoted-lines "=\r\n" swap subseq? ] unit-test +{ t } [ message >quoted-lines "=\r\n" find-subseq? ] unit-test { 4 } [ message >quoted-lines split-lines length ] unit-test { "===o" } [ message >quoted-lines split-lines [ last ] "" map-as ] unit-test diff --git a/basis/sequences/generalizations/generalizations.factor b/basis/sequences/generalizations/generalizations.factor index afab0b3217..415ec88800 100644 --- a/basis/sequences/generalizations/generalizations.factor +++ b/basis/sequences/generalizations/generalizations.factor @@ -124,7 +124,7 @@ MACRO: (ncollect) ( n -- quot ) MACRO: nmap-reduce ( map-quot reduce-quot n -- quot ) -rot dupd compose overd over '[ [ [ first ] _ napply @ 1 ] _ nkeep - _ _ (neach) (each-integer) + _ _ (neach) each-integer-from ] ; : nall? ( seqs... quot n -- ? ) diff --git a/basis/sorting/insertion/insertion.factor b/basis/sorting/insertion/insertion.factor index 2a2ac4134a..425b547dd8 100644 --- a/basis/sorting/insertion/insertion.factor +++ b/basis/sorting/insertion/insertion.factor @@ -16,4 +16,4 @@ PRIVATE> : insertion-sort ( ... seq quot: ( ... elt -- ... elt' ) -- ... ) ! quot is a transformation on elements - over length [ insert ] 2with 1 -rot (each-integer) ; inline + over length [ insert ] 2with 1 -rot each-integer-from ; inline diff --git a/basis/tools/hexdump/hexdump.factor b/basis/tools/hexdump/hexdump.factor index c5bb93a7c9..feaa8c542c 100644 --- a/basis/tools/hexdump/hexdump.factor +++ b/basis/tools/hexdump/hexdump.factor @@ -35,7 +35,7 @@ CONSTANT: hex-digits $[ [ 0 swap length ] keep ; inline : each-byte ( from to bytes quot: ( elt -- ) -- ) - '[ _ nth-unsafe @ ] (each-integer) ; inline + '[ _ nth-unsafe @ ] each-integer-from ; inline : write-bytes ( from to bytes stream -- ) '[ hex-digits nth-unsafe _ stream-write ] each-byte ; inline diff --git a/basis/tools/test/test-tests.factor b/basis/tools/test/test-tests.factor index fd51d8af8b..50e36d4471 100644 --- a/basis/tools/test/test-tests.factor +++ b/basis/tools/test/test-tests.factor @@ -16,5 +16,5 @@ sequences tools.test tools.test.private ; ! Just verifies that the presented output contains a callstack. { t } [ create-test-failure [ error. ] with-string-writer - "OBJ-CURRENT-THREAD" swap subseq? + "OBJ-CURRENT-THREAD" find-subseq? ] unit-test diff --git a/basis/ui/images/images.factor b/basis/ui/images/images.factor index 79ea0a8691..b11520e390 100644 --- a/basis/ui/images/images.factor +++ b/basis/ui/images/images.factor @@ -12,7 +12,7 @@ C: image-name >2x? ] bi ; + [ load-image ] [ "@2x" find-subseq? >>2x? ] bi ; PRIVATE> diff --git a/extra/bittorrent/bittorrent.factor b/extra/bittorrent/bittorrent.factor index 1509788e66..1564022d9b 100644 --- a/extra/bittorrent/bittorrent.factor +++ b/extra/bittorrent/bittorrent.factor @@ -73,7 +73,7 @@ M: string load-metainfo dup "announce-list" of [ nip first random ] [ "announce" of ] if* ; : scrape-url ( metainfo -- url/f ) - announce-url "announce" over path>> subseq? [ + announce-url dup path>> "announce" find-subseq? [ [ "announce" "scrape" replace ] change-path ] [ drop f ] if ; @@ -425,7 +425,7 @@ M: peer dispose :: next-block ( peer -- peer ) peer current-index>> [ 1 + ] [ 0 ] if* peer #pieces>> - peer bitfield>> '[ _ check-bitfield ] (find-integer) + peer bitfield>> '[ _ check-bitfield ] find-integer-from peer current-index<< 0 peer current-piece>> set-length peer ; diff --git a/extra/cli/git/git.factor b/extra/cli/git/git.factor index 22b59f2312..5a431c3e12 100644 --- a/extra/cli/git/git.factor +++ b/extra/cli/git/git.factor @@ -63,4 +63,4 @@ cli-git-num-parallel [ cpus 2 * ] initialize : directory-entries-without-git ( directory -- entries ) recursive-directory-entries - [ name>> "/.git/" swap subseq? ] reject ; \ No newline at end of file + [ name>> "/.git/" find-subseq? ] reject ; \ No newline at end of file diff --git a/extra/codebase-analyzer/codebase-analyzer.factor b/extra/codebase-analyzer/codebase-analyzer.factor index 0680d6b41b..55e3a2ac1c 100644 --- a/extra/codebase-analyzer/codebase-analyzer.factor +++ b/extra/codebase-analyzer/codebase-analyzer.factor @@ -23,10 +23,10 @@ IN: codebase-analyzer [ has-file-extension? ] filter ; : without-git-paths ( paths -- paths' ) - [ "/.git/" swap subseq? ] reject ; + [ "/.git/" find-subseq? ] reject ; : without-node-modules-paths ( paths -- paths' ) - [ "/node_modules/" swap subseq? ] reject ; + [ "/node_modules/" find-subseq? ] reject ; : regular-directory-files ( path -- seq ) recursive-directory-files diff --git a/extra/gemini/cli/cli.factor b/extra/gemini/cli/cli.factor index 9243475bd3..a59cfe68bc 100644 --- a/extra/gemini/cli/cli.factor +++ b/extra/gemini/cli/cli.factor @@ -101,7 +101,7 @@ CONSTANT: URL V{ } : gemini-go ( args -- ) present [ DEFAULT-URL ] when-empty - { [ "://" over subseq? ] [ "gemini://" head? ] } 1|| + { [ dup "://" find-subseq? ] [ "gemini://" head? ] } 1|| [ "gemini://" prepend ] unless dup "gemini://" head? [ [ add-history ] [ add-stack ] [ gemini-get ] tri diff --git a/extra/html/parser/analyzer/analyzer.factor b/extra/html/parser/analyzer/analyzer.factor index 43b859d618..6fd88ddbdc 100644 --- a/extra/html/parser/analyzer/analyzer.factor +++ b/extra/html/parser/analyzer/analyzer.factor @@ -142,7 +142,7 @@ ERROR: undefined-find-nth m n seq quot ; [ { [ name>> = ] [ closing?>> not ] } 1&& ] with find-all ; : href-contains? ( str tag -- ? ) - "href" attribute* [ subseq? ] [ 2drop f ] if ; + "href" attribute* [ swap find-subseq? ] [ 2drop f ] if ; : find-hrefs ( vector -- vector' ) [ { [ name>> "a" = ] [ "href" attribute? ] } 1&& ] filter sift diff --git a/extra/lint/lint.factor b/extra/lint/lint.factor index 4b754ef42e..53ef1f453e 100644 --- a/extra/lint/lint.factor +++ b/extra/lint/lint.factor @@ -249,7 +249,7 @@ GENERIC: lint ( obj -- seq ) M: object lint ( obj -- seq ) drop f ; M: callable lint ( quot -- seq ) - [ lint-definitions-keys get-global ] dip '[ _ subseq? ] filter ; + lint-definitions-keys get-global [ find-subseq? ] with filter ; M: word lint ( word -- seq/f ) def>> [ callable? ] deep-filter [ lint ] map concat ; diff --git a/extra/mason/git/git.factor b/extra/mason/git/git.factor index 19d522f1e9..8bc24c406d 100644 --- a/extra/mason/git/git.factor +++ b/extra/mason/git/git.factor @@ -47,7 +47,7 @@ IN: mason.git : git-pull-failed ( error -- ) dup output-process-error? [ - dup output>> "not uptodate. Cannot merge." swap subseq? + dup output>> "not uptodate. Cannot merge." find-subseq? [ git-repo-corrupted ] [ rethrow ] if diff --git a/extra/mediawiki/api/api.factor b/extra/mediawiki/api/api.factor index 03e8472594..9e6ce829c7 100644 --- a/extra/mediawiki/api/api.factor +++ b/extra/mediawiki/api/api.factor @@ -104,7 +104,7 @@ t botflag set-global : nonce-already-used? ( assoc -- ? ) "error" of [ "code" of "mwoauth-invalid-authorization" = ] - [ "info" of "Nonce already used" swap subseq-start ] bi + [ "info" of "Nonce already used" find-subseq ] bi and ; : readonly? ( assoc -- ? ) diff --git a/extra/metar/metar.factor b/extra/metar/metar.factor index 5a740a025d..d882490503 100644 --- a/extra/metar/metar.factor +++ b/extra/metar/metar.factor @@ -282,7 +282,7 @@ CONSTANT: compass-directions H{ ] if ; : parse-weather ( str -- str' ) - "VC" over subseq? [ "VC" "" replace t ] [ f ] if + dup "VC" find-subseq? [ "VC" "" replace t ] [ f ] if [ (parse-weather) ] [ [ " in the vicinity" append ] when ] bi* ; diff --git a/extra/modern/slices/slices.factor b/extra/modern/slices/slices.factor index 54b90c8472..001c4e1ad6 100644 --- a/extra/modern/slices/slices.factor +++ b/extra/modern/slices/slices.factor @@ -182,7 +182,7 @@ ERROR: expected-sequence-error expected actual ; ERROR: subseq-expected-but-got-eof n string expected ; :: slice-til-string ( n string search -- n' string payload end-string ) - search string n subseq-start-from :> n' + n string search find-subseq-from :> n' n' [ n string search subseq-expected-but-got-eof ] unless n' search length + string n n' string ? @@ -206,8 +206,8 @@ ERROR: subseq-expected-but-got-eof n string expected ; : rewind-slice ( n string slice -- n' string ) 2nip [ from>> ] [ seq>> ] bi ; inline -:: take-from? ( n seq subseq -- n'/f seq ? ) - subseq seq n pick length (subseq-start-from) 2nip [ +:: take-from? ( n seq subseq -- n'/f seq ? ) + n seq subseq subseq-starts-at? [ n subseq length + seq t diff --git a/extra/rosetta-code/text-processing/max-licenses/max-licenses.factor b/extra/rosetta-code/text-processing/max-licenses/max-licenses.factor index 602d44e7b9..2b875f9726 100644 --- a/extra/rosetta-code/text-processing/max-licenses/max-licenses.factor +++ b/extra/rosetta-code/text-processing/max-licenses/max-licenses.factor @@ -32,7 +32,7 @@ TUPLE: maxlicense max-count current-count times ; : ( -- max ) -1 0 V{ } clone \ maxlicense boa ; inline -: out? ( line -- ? ) [ "OUT" ] dip subseq? ; inline +: out? ( line -- ? ) "OUT" find-subseq? ; inline : line-time ( line -- time ) split-words harvest fourth ; inline diff --git a/extra/rosetta-code/web-scraping/web-scraping.factor b/extra/rosetta-code/web-scraping/web-scraping.factor index c44ef62554..1a426f9a11 100644 --- a/extra/rosetta-code/web-scraping/web-scraping.factor +++ b/extra/rosetta-code/web-scraping/web-scraping.factor @@ -16,6 +16,6 @@ IN: rosetta-code.web-scraping : web-scraping-main ( -- ) "http://tycho.usno.navy.mil/cgi-bin/timer.pl" http-get nip - [ "UTC" swap subseq-start [ 9 - ] [ 1 - ] bi ] keep subseq print ; + [ "UTC" find-subseq [ 9 - ] [ 1 - ] bi ] keep subseq print ; MAIN: web-scraping-main diff --git a/extra/sequences/extras/extras.factor b/extra/sequences/extras/extras.factor index 9d6de7a958..334f352638 100644 --- a/extra/sequences/extras/extras.factor +++ b/extra/sequences/extras/extras.factor @@ -315,7 +315,7 @@ PRIVATE> : 3each-from ( ... seq1 seq2 seq3 quot: ( ... elt1 elt2 elt3 -- ... ) i -- ... ) - [ (3each) ] dip -rot (each-integer) ; inline + [ (3each) ] dip -rot each-integer-from ; inline : 3map-reduce ( ..a seq1 seq2 seq3 map-quot: ( ..a elt1 elt2 elt3 -- ..b intermediate ) reduce-quot: ( ..b prev intermediate -- ..a next ) -- ..a result ) @@ -598,7 +598,7 @@ PRIVATE> [ length 1 - swap - ] [ nth ] bi ; inline : each-index-from ( ... seq quot: ( ... elt index -- ... ) i -- ... ) - -rot (each-index) (each-integer) ; inline + -rot (each-index) each-integer-from ; inline :: (start-all) ( seq subseq increment -- indices ) 0 - [ [ subseq seq ] dip subseq-start-from dup ] + [ seq subseq find-subseq-from dup ] [ [ increment + ] keep ] produce nip ; : start-all ( seq subseq -- indices ) diff --git a/extra/stack-as-data/stack-as-data.factor b/extra/stack-as-data/stack-as-data.factor index 17cbc53feb..fef8c56414 100644 --- a/extra/stack-as-data/stack-as-data.factor +++ b/extra/stack-as-data/stack-as-data.factor @@ -16,8 +16,5 @@ MACRO: stack-exchange ( m n -- quot ) swapd '[ _ _ stack-set-nth _ _ stack-set-nth ] ; -! MACRO: stack-filter ( n quot: ( obj -- ? ) -- quot' ) -! selector [ '[ _ ] replicate spread ] dip ; - MACRO: stack-map ( n quot: ( obj -- obj' ) -- quot' ) '[ _ ] replicate '[ _ spread ] ; diff --git a/extra/txon/txon.factor b/extra/txon/txon.factor index 7bdfcec510..f681ef3c21 100644 --- a/extra/txon/txon.factor +++ b/extra/txon/txon.factor @@ -42,7 +42,7 @@ DEFER: name/values : name=value ( string -- remain term ) [ unicode:blank? ] trim - ":`" over subseq? [ (name=value) ] [ f swap ] if ; + dup ":`" find-subseq? [ (name=value) ] [ f swap ] if ; : name/values ( string -- remain terms ) [ dup { [ empty? not ] [ first CHAR: ` = not ] } 1&& ] diff --git a/extra/zoneinfo/zoneinfo.factor b/extra/zoneinfo/zoneinfo.factor index 834408aac3..5503f7bf96 100644 --- a/extra/zoneinfo/zoneinfo.factor +++ b/extra/zoneinfo/zoneinfo.factor @@ -147,7 +147,7 @@ MEMO: zoneinfo-assoc ( -- assoc ) : zoneinfo-zones ( -- seq ) raw-zone-map keys - [ "/" swap subseq? ] partition + [ "/" find-subseq? ] partition [ natural-sort ] bi@ append ; GENERIC: zone-matches? ( string rule -- ? ) @@ -232,8 +232,8 @@ ERROR: unknown-day-abbrev day ; : comparison-day-string ( timestamp string -- timestamp ) { - { [ ">=" over subseq? ] [ ">=" split1 swap [ string>number >>day ] dip day-abbrev>= ] } - { [ "<=" over subseq? ] [ "<=" split1 swap [ string>number >>day ] dip day-abbrev<= ] } + { [ dup ">=" find-subseq? ] [ ">=" split1 swap [ string>number >>day ] dip day-abbrev>= ] } + { [ dup "<=" find-subseq? ] [ "<=" split1 swap [ string>number >>day ] dip day-abbrev<= ] } [ string>number >>day ] } cond ;