]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: bound -> index-or-length
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 31 Jul 2022 15:25:27 +0000 (10:25 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 31 Jul 2022 18:26:02 +0000 (13:26 -0500)
33 files changed:
basis/farkup/farkup.factor
basis/formatting/formatting.factor
basis/furnace/syndication/syndication.factor
basis/help/apropos/apropos.factor
basis/help/syntax/syntax.factor
basis/logging/analysis/analysis.factor
basis/multiline/multiline.factor
basis/prettyprint/prettyprint.factor
basis/simple-flat-file/simple-flat-file.factor
basis/tools/completion/completion.factor
basis/tools/trace/trace.factor
basis/ui/gadgets/incremental/incremental.factor
basis/ui/tools/listener/completion/completion.factor
basis/ui/tools/listener/listener.factor
basis/uuid/uuid.factor
core/sequences/sequences-docs.factor
core/sequences/sequences.factor
core/strings/parser/parser.factor
core/system/system.factor
extra/codebase-analyzer/codebase-analyzer.factor
extra/colors/flex-hex/flex-hex.factor
extra/hacker-news/hacker-news.factor
extra/id3/id3.factor
extra/mason/email/email.factor
extra/mason/report/report.factor
extra/pdf/layout/layout.factor
extra/project-euler/117/117.factor
extra/rosetta-code/top-rank/top-rank.factor
extra/spider/report/report.factor
extra/syslog/syslog.factor
extra/ui/gadgets/charts/lines/lines.factor
extra/webapps/planet/planet.factor
extra/youtube/youtube.factor

index 92b2824fc1aba04b761604439f164c582de1d1e9..1c901d9fdb08477222b787959de8e6afcaed1571 100644 (file)
@@ -50,7 +50,7 @@ DEFER: (parse-paragraph)
     parse-paragraph paragraph boa ;
 
 : cut-half-slice ( string i -- before after-slice )
-    [ head ] [ 1 + bound tail-slice ] 2bi ;
+    [ head ] [ 1 + index-or-length tail-slice ] 2bi ;
 
 : find-cut ( string quot -- before after delimiter )
     dupd find
index 5de21901b3795a93ad581788ac477529f49916e0..535133e7b65b4d00f237388c64d107bde610c47e 100644 (file)
@@ -106,7 +106,7 @@ pad       = pad-align pad-char pad-width => [[ <reversed> >quotation dup first 0
 sign_     = [+ ]                 => [[ '[ dup first CHAR: - = [ _ prefix ] unless ] ]]
 sign      = (sign_)?             => [[ [ ] or ]]
 
-width_    = "." ([0-9])*         => [[ second >digits '[ _ bound head ] ]]
+width_    = "." ([0-9])*         => [[ second >digits '[ _ index-or-length head ] ]]
 width     = (width_)?            => [[ [ ] or ]]
 
 digits_   = "." ([0-9])*         => [[ second >digits ]]
index ad3a1b91274fc93ae1925a5e5e6ce058a54908b8..3311b84a7c2e2dda6d9d23633e5ed3c05d16495d 100644 (file)
@@ -29,7 +29,7 @@ M: object >entry
         } cleave ;
 
 : process-entries ( seq -- seq' )
-    20 bound head-slice [
+    20 index-or-length head-slice [
         >entry clone
         [ adjust-url ] change-url
     ] map ;
index 0dd9eb0d57854de92c1010eac78f251bf7a5a677..1becf02529239474a319bd266ee91100ab7661d6 100644 (file)
@@ -52,7 +52,7 @@ M: more-completions article-content
     completions [
         [
             { $heading search } ,
-            [ max-completions bound head keys \ $completions prefix , ]
+            [ max-completions index-or-length head keys \ $completions prefix , ]
             [
                 length max-completions >
                 [ { $link T{ more-completions f completions search category } } , ] when
index ba658aa3fb692f75e246e7a66234312744d0527a..2cb4614c6ca5f49d4ba3ebc6f87703eaa3f43020 100644 (file)
@@ -91,7 +91,7 @@ DEFER: HELP{
 
 : trim-whitespace ( seq -- seq' )
     dup rest-slice dup whitespace
-    [ '[ _ bound tail ] map! ] unless-zero drop
+    [ '[ _ index-or-length tail ] map! ] unless-zero drop
     0 over [ [ blank? ] trim-head ] change-nth ;
 
 : code-lines ( str -- seq )
index baeeeb0b1664cd5f795e015cf5cfbd112589fb50..84c267400992481c5fb0a67a8d0a5b8195ff7235 100644 (file)
@@ -20,7 +20,7 @@ SYMBOL: message-histogram
     drop ;
 
 : recent-histogram ( assoc n -- alist )
-    [ sort-values <reversed> ] dip bound head ;
+    [ sort-values <reversed> ] dip index-or-length head ;
 
 : analyze-entries ( entries word-names -- errors word-histogram message-histogram )
     [
index cd33adc9bed15bfeed6982090d646bc5967a301a..975d88493ffbedfda2b83b0db661b455bb4733b5 100644 (file)
@@ -44,7 +44,7 @@ SYNTAX: STRING:
         i text end subseq-index-from [| j |
             i j text subseq % j end length +
         ] [
-            text i bound tail % CHAR: \n ,
+            text i index-or-length tail % CHAR: \n ,
             lexer next-line
             0 end lexer (scan-multiline-string)
         ] if*
index f389b351ecde39e912d0ac93057e197058eec9ea..a96a1eec1da2bfe04c127ea3a7ad82ca1d89d1ff 100644 (file)
@@ -70,7 +70,7 @@ SYMBOL: =>
     ] [ ] make ;
 
 : remove-breakpoints ( quot pos -- quot' )
-    1 + bound cut [ (remove-breakpoints) ] bi@ [ => ] glue ;
+    1 + index-or-length cut [ (remove-breakpoints) ] bi@ [ => ] glue ;
 
 : optimized-frame? ( triple -- ? ) second word? ;
 
index e6c5233f890a9822d98afa30a5df1edc35322143..d9d2bfb97e9a42df065d114cb5adc5d6f0652db3 100644 (file)
@@ -12,7 +12,7 @@ IN: simple-flat-file
     [ drop-comment ] map harvest ;
 
 : split-column ( line -- columns )
-    " \t" split harvest 2 bound head 2 f pad-tail ;
+    " \t" split harvest 2 index-or-length head 2 f pad-tail ;
 
 : parse-hex ( s -- n )
     dup [
index 49ca364ab54172c1d9e1703799ceb4cb9415ec00..63483d17f4f54c1667e934152b1a4580e6f2461c 100644 (file)
@@ -146,7 +146,7 @@ PRIVATE>
     { ";" } split1-last [ ] [ ] ?if ;
 
 : complete-vocab-list? ( tokens -- ? )
-    chop-; 1 bound head* "USING:" swap member? ;
+    chop-; 1 index-or-length head* "USING:" swap member? ;
 
 PRIVATE>
 
index 622cfcb6863abcbe10fe5cc3199a145f1b6dc2c6..3f58dbc4532b49bf6e8c9c341edf427d8ae02a22 100644 (file)
@@ -33,7 +33,7 @@ M: trace-step-state summary
     ] "" make ;
 
 : <trace-step> ( continuation word -- trace-step )
-    [ nip ] [ [ data>> ] [ stack-effect in>> length ] bi* bound tail* ] 2bi
+    [ nip ] [ [ data>> ] [ stack-effect in>> length ] bi* index-or-length tail* ] 2bi
     \ trace-step-state boa ;
 
 : print-step ( continuation -- )
index 578594ad2985e7f693ac9d4581c722633a04a9be..3b2d7c94b990e688fc166f2f2183addf36268ce1 100644 (file)
@@ -39,7 +39,7 @@ M: incremental dim-changed drop ;
     dup children>> length 200,000 > [
         ! We let the length oscillate between 100k-200k, so we don't
         ! have to relayout the container every time a gadget is added.
-        [ 100,000 bound cut* ] change-children
+        [ 100,000 index-or-length cut* ] change-children
 
         ! Unfocus if any focused gadgets were removed and relayout
         dup focus>> pick member-eq? [ f >>focus ] when relayout yield
index a67a0766959e286984914c321216353f752a495c..56cbc24f155c4b609ea837d553f7ecd2f2d49e79 100644 (file)
@@ -120,7 +120,7 @@ TUPLE: completion-popup < track interactor table completion-mode ;
     [ completion-popup? ] find-parent ;
 
 : <completion-model> ( editor element quot -- model )
-    [ <element-model> ] dip '[ @ >alist 100 bound head ] <arrow> ;
+    [ <element-model> ] dip '[ @ >alist 100 index-or-length head ] <arrow> ;
 
 M: completion-popup focusable-child* table>> ;
 
index e366aa543a5772db451d4a80a0bc0bc9b00a8472..e87b06112b1571deafff6823b517e31cfb7541e1 100644 (file)
@@ -162,7 +162,7 @@ M:: interactor stream-read-unsafe ( n buf interactor -- count )
     n [ 0 ] [
         drop
         interactor interactor-read dup [ join-lines ] when
-        n bound [ head-slice 0 buf copy ] keep
+        n index-or-length [ head-slice 0 buf copy ] keep
     ] if-zero ;
 
 M: interactor stream-read1
index 13b055a6c6036ca55cfb46e194127b5c74a6e5c2..44e1fc9d15e090bccba5ced058cdef17c1f7aa4d 100644 (file)
@@ -64,7 +64,7 @@ PRIVATE>
 
 : uuid3 ( namespace name -- string )
     [ uuid-parse ] dip append
-    md5 checksum-bytes 16 bound head be>
+    md5 checksum-bytes 16 index-or-length head be>
     3 (version) uuid>string ;
 
 : uuid4 ( -- string )
@@ -73,7 +73,7 @@ PRIVATE>
 
 : uuid5 ( namespace name -- string )
     [ uuid-parse ] dip append
-    sha1 checksum-bytes 16 bound head be>
+    sha1 checksum-bytes 16 index-or-length head be>
     5 (version) uuid>string ;
 
 : uuid6 ( -- string )
index 54e7d705b755d7323d583b251d3c55dc695802b3..beee253aa31ff32c32aeebd85c0e167e59d59232 100644 (file)
@@ -1080,7 +1080,7 @@ HELP: head
     }
     "When a sequence may not have enough elements:"
     { $example "USING: sequences prettyprint ;"
-        "{ 1 2 } 5 bound head ."
+        "{ 1 2 } 5 index-or-length head ."
         "{ 1 2 }"
     }
 }
@@ -1096,7 +1096,7 @@ HELP: tail
     }
     "When a sequence may not have enough elements:"
     { $example "USING: sequences prettyprint ;"
-        "{ 1 2 } 5 bound tail ."
+        "{ 1 2 } 5 index-or-length tail ."
         "{ }"
     }
 }
@@ -1122,7 +1122,7 @@ HELP: head*
     }
     "When a sequence may not have enough elements:"
     { $example "USING: sequences prettyprint ;"
-        "{ 1 2 } 5 bound head* ."
+        "{ 1 2 } 5 index-or-length head* ."
         "{ }"
     }
 }
@@ -1138,7 +1138,7 @@ HELP: tail*
     }
     "When a sequence may not have enough elements:"
     { $example "USING: sequences prettyprint ;"
-        "{ 1 2 } 5 bound tail* ."
+        "{ 1 2 } 5 index-or-length tail* ."
         "{ 1 2 }"
     }
 }
@@ -1632,7 +1632,7 @@ HELP: bound
      { "seq" sequence } { "n" integer } { "n'" integer } }
 { $description "Returns the input sequence and its length or " { $snippet "n" } ", whichever is less." }
 { $examples { $example "USING: sequences kernel prettyprint ;"
-    "\"abcd\" 3 bound [ . ] bi@"
+    "\"abcd\" 3 index-or-length [ . ] bi@"
     "\"abcd\"\n3"
 } } ;
 
index 213b2f95f040e94f026b0d993786ca4f97d3ee0f..7ff0947f28ec515ff87ff7ae4fcbd61eee09a3a4 100644 (file)
@@ -247,7 +247,7 @@ M: slice virtual@ [ from>> + ] [ seq>> ] bi ; inline
 
 M: slice length [ to>> ] [ from>> ] bi - ; inline
 
-: bound ( seq n -- seq n' ) over length min ; inline
+: index-or-length ( seq n -- seq n' ) over length min ; inline
 
 : head-slice ( seq n -- slice ) head-to-index <slice> ; inline
 
index 8cd30f37f4305251657f151f8113102bd4ead268..bff33f24298e41399267fca112eaff63282f2af3 100644 (file)
@@ -36,7 +36,7 @@ name>char-hook [
     2 cut-slice [ hex> ] dip ;
 
 : oct-escape ( str -- ch/f str' )
-    dup 3 bound head-slice [
+    dup 3 index-or-length head-slice [
         [ CHAR: 0 CHAR: 7 between? not ] find drop
     ] keep '[ _ length ] unless* [ f ] when-zero
     [ cut-slice [ oct> ] dip ] [ f swap ] if* ;
index 397f7466cad0d4907717bca0bbb01e0fe0628112..03d01e2d1d2f1542f8442b6fa98d1b4929740b83 100644 (file)
@@ -77,7 +77,7 @@ PRIVATE>
         " " % cpu name>> %
         " (" % build # ", " %
         vm-git-ref % "-" %
-        vm-git-id 10 bound head % ", " %
+        vm-git-id 10 index-or-length head % ", " %
         vm-compile-time % ")\n[" %
         vm-compiler % "] on " % os name>> %
     ] "" make ;
index c0b4226265055c5e9f93b81fddb639092c47cfdf..ab5a80a42953ed21a3544ba6b7596a1d326e6058 100644 (file)
@@ -167,10 +167,10 @@ IN: codebase-analyzer
         [ uses-make? [ "uses make" print ] when ]
         [ rc-files [ length "has %d rc files" sprintf print ] unless-empty ]
         [ ignore-files [ length "has %d ignore files" sprintf print ] unless-empty nl ]
-        [ "Top 20 largest files" print file-sizes sort-values 20 bound tail* [ normalize-path ] map-keys reverse assoc. nl ]
-        [ "Top 10 file extension sizes" print sum-sizes-by-extension 10 bound tail* reverse assoc. nl ]
-        [ "Top 10 text file line counts" print sum-line-counts-by-extension 10 bound tail* reverse assoc. nl ]
-        [ "Top 10 file extension counts" print count-by-file-extension 10 bound tail* reverse assoc. nl ]
+        [ "Top 20 largest files" print file-sizes sort-values 20 index-or-length tail* [ normalize-path ] map-keys reverse assoc. nl ]
+        [ "Top 10 file extension sizes" print sum-sizes-by-extension 10 index-or-length tail* reverse assoc. nl ]
+        [ "Top 10 text file line counts" print sum-line-counts-by-extension 10 index-or-length tail* reverse assoc. nl ]
+        [ "Top 10 file extension counts" print count-by-file-extension 10 index-or-length tail* reverse assoc. nl ]
     } cleave ;
 
 : analyze-codebase ( path -- )
index d75f3b2930336ef780862e17630a79607c2abdc4..b964d6ed50966fb01ccd84b30d9018da926676db 100644 (file)
@@ -19,8 +19,8 @@ IN: colors.flex-hex
 
 : hex-rgb ( array -- array' )
     [
-        8 bound tail*
-        2 bound head
+        8 index-or-length tail*
+        2 index-or-length head
         2 CHAR: 0 pad-head
     ] map ;
 
index a4bc74ce04b8b9793eeabbbd2c3ab166a0e08295..212b7fd5b9af93e4d2635d36528cb67f288bf4cd 100644 (file)
@@ -20,7 +20,7 @@ CONSTANT: christmas-green COLOR: #376627
     "https://hacker-news.firebaseio.com/v0/item/%d.json?print=pretty" sprintf ;
 
 : hacker-news-items ( n endpoint -- seq )
-    hacker-news-ids swap bound head
+    hacker-news-ids swap index-or-length head
     [ hacker-news-id>json-url http-get nip json> ] parallel-map ;
 
 : hacker-news-top-stories ( n -- seq )
index 2e81717d3c6e71b880f19be5e90fda540d9d79dc..17d79abf51fc73b31487e7904be51ba5b89c58ca 100644 (file)
@@ -116,7 +116,7 @@ CONSTANT: id3v1+-length 227
     [ 10 over size>> 10 + ] dip <slice> filter-text-data ;
 
 : decode-text ( string -- string' )
-    dup 2 bound head
+    dup 2 index-or-length head
     { { 0xff 0xfe } { 0xfe 0xff } } member?
     utf16 ascii ? decode ;
 
index ddeec95bc5add40c944414632e42240d53bec026..ebe869cc29a85d1590c91c18875056b709f8d2d3 100644 (file)
@@ -25,7 +25,7 @@ IN: mason.email
 : report-subject ( status -- string )
     [
         subject-prefix %
-        current-git-id get 7 bound head %
+        current-git-id get 7 index-or-length head %
         " -- " %
         {
             { status-clean [ "clean" ] }
index 0ec1e4bf48170d52244e7b41ce0b234336b51278..3dffe3d54bf678a2bc11052af71a16206e14fd14 100644 (file)
@@ -37,7 +37,7 @@ IN: mason.report
     ] with-file-writer ; inline
 
 : file-tail ( file encoding lines -- seq )
-    [ file-lines ] dip bound tail* join-lines ;
+    [ file-lines ] dip index-or-length tail* join-lines ;
 
 :: failed-report ( error file what -- status )
     [
index d8b976fcef919c23a987f2cf47ef4421d2afe8bb..3f3c4a2fe371ef609b38b941467d5b233e560a1e 100644 (file)
@@ -101,7 +101,7 @@ M: p pdf-render
     [
         over ?line-break
         over [ font>> ] [ avail-width ] bi visual-wrap
-        over avail-lines bound cut
+        over avail-lines index-or-length cut
         [ draw-text ] [ "" concat-as ] bi*
     ] change-string dup string>> empty? [ drop f ] when ;
 
@@ -134,7 +134,7 @@ M: text pdf-render
             [ { } ] [ over [ font>> ] [ width ] bi visual-wrap ]
             if-empty
         ] dip [ prefix ] when*
-        over avail-lines bound cut
+        over avail-lines index-or-length cut
         [ draw-text ] [ "" concat-as ] bi*
     ] change-string dup string>> empty? [ drop f ] when ;
 
index 255fb20bea704934e90fd18536362760632282e9..ae23776f6be65bc597e524d9ef9141fd032bc8c3 100644 (file)
@@ -28,7 +28,7 @@ IN: project-euler.117
 <PRIVATE
 
 : next ( seq -- )
-    [ 4 bound tail* sum ] keep push ;
+    [ 4 index-or-length tail* sum ] keep push ;
 
 : (euler117) ( n -- m )
     [ V{ 1 } clone ] dip over [ next ] curry times last ;
index 361aca3b21ffd34446b065e298daad05af5cf84a..8a96e11d57b3de3df692129bf0f93e1141a1d04c 100644 (file)
@@ -51,7 +51,7 @@ CONSTANT: employees {
     [ [ salary>> ] inv-sort-with ] assoc-map ;
 
 : first-n-each ( seq n quot -- )
-    [ bound head-slice ] dip each ; inline
+    [ index-or-length head-slice ] dip each ; inline
 
 : top-rank-main ( -- )
     employees prepare-departments [
index 99c7a720c075b5b570dc08cfc9515f313cf1bd3e..711d8e4a6d025ce0936f7580a35bf46ba4f75d6a 100644 (file)
@@ -36,7 +36,7 @@ SYMBOL: time-std
 
 : process-timings ( -- )
     timings get sort-values
-    [ slowest bound tail* reverse slowest-pages set ]
+    [ slowest index-or-length tail* reverse slowest-pages set ]
     [
         values [
             [ mean 1000000 /f mean-time set ]
index 992b7b9cc8ddf2a454acf1da9e91b3beb6af2334..998c873f22b7d37ec67e95917384630f667b27c1 100644 (file)
@@ -65,7 +65,7 @@ PRIVATE>
 
 : syslog ( message level -- )
     utf8 [ write-syslog ] with-byte-writer
-    1024 bound head
+    1024 index-or-length head
     syslog-server get-global
     $[ f 0 <inet4> <datagram> ]
     send ;
index f56c9f93588fe87877c3141bca9e1f6e2c665eac..89d9fb58c4ba5dda7c6d6909c33c2002c19be004 100644 (file)
@@ -38,7 +38,7 @@ ALIAS: y second
 ! right of the index, plus one that's not equal, if requested.
 :: adjusted-head-slice ( n elt plus-one? seq -- slice )
     n seq elt x '[ x _ = not ] find-from drop seq swap
-    [ plus-one? [ 1 + ] when bound head-slice ] when* ;
+    [ plus-one? [ 1 + ] when index-or-length head-slice ] when* ;
 
 ! : data-rect ( data -- rect )
 !    [ [ first x ] [ last x ] bi ] keep
index 941caecee154f03743c59bd23ae4d4d4bb015318..ff6d94a0a678074e6ddbe8fd198719ce1290a69f 100644 (file)
@@ -93,7 +93,7 @@ posting "POSTINGS"
     [ date>> ] inv-sort-with ;
 
 : update-cached-postings ( -- )
-    blogroll fetch-blogroll sort-entries 8 bound head [
+    blogroll fetch-blogroll sort-entries 8 index-or-length head [
         posting new delete-tuples
         [ insert-tuple ] each
     ] with-transaction ;
index 4d44b7a2fc8844c197fd50bb595a2435def5575c..5c0e3b45d439d19ce2852e841f2284a64d59bd8c 100644 (file)
@@ -61,7 +61,7 @@ CONSTANT: video-info-url URL" http://www.youtube.com/get_video_info"
 : sanitize ( title -- title' )
     [ 0 31 between? ] reject
     [ "\"#$%'*,./:;<>?^|~\\" member? ] reject
-    200 bound head ;
+    200 index-or-length head ;
 
 : downloadable? ( video-info -- ? )
     "use_cipher_signature" of "False" = ;