]> gitweb.factorcode.org Git - factor.git/commitdiff
core: Change lines -> read-lines, contents -> read-contents, string-lines -> lines
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 20 Dec 2021 20:12:32 +0000 (14:12 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 20 Dec 2021 20:19:19 +0000 (14:19 -0600)
Add unlines word.

Related to #2140

61 files changed:
basis/bootstrap/compiler/compiler.factor
basis/bootstrap/image/download/download.factor
basis/calendar/format/format.factor
basis/documents/documents.factor
basis/escape-strings/escape-strings.factor
basis/eval/eval.factor
basis/farkup/farkup.factor
basis/ftp/server/server.factor
basis/help/syntax/syntax.factor
basis/html/components/components.factor
basis/html/templates/fhtml/fhtml.factor
basis/http/http-tests.factor
basis/io/launcher/launcher-docs.factor
basis/io/launcher/windows/windows-tests.factor
basis/io/streams/limited/limited-tests.factor
basis/io/streams/string/string-tests.factor
basis/logging/logging.factor
basis/mime/multipart/multipart.factor
basis/peg/ebnf/ebnf.factor
basis/quoted-printable/quoted-printable-tests.factor
basis/resolv-conf/resolv-conf.factor
basis/strings/tables/tables.factor
basis/tools/deploy/config/editor/editor.factor
basis/ui/gadgets/labels/labels.factor
basis/ui/gadgets/tables/tables.factor
basis/unicode/collation/collation-tests.factor
basis/vocabs/platforms/platforms.factor
basis/wrap/strings/strings.factor
basis/xmode/code2html/code2html-tests.factor
basis/xmode/highlight/highlight.factor
core/classes/tuple/tuple-tests.factor
core/io/io-docs.factor
core/io/io.factor
core/io/streams/byte-array/byte-array-tests.factor
core/splitting/splitting-docs.factor
core/splitting/splitting-tests.factor
core/splitting/splitting.factor
extra/backticks/backticks.factor
extra/compiler/cfg/graphviz/graphviz.factor
extra/gemini/cli/cli.factor
extra/gemini/gemini.factor
extra/git/git-tests.factor
extra/git/git.factor
extra/gopher/gopher.factor
extra/io/streams/counting/counting-tests.factor
extra/literate/literate.factor
extra/machine-learning/data-sets/data-sets.factor
extra/metar/metar.factor
extra/pdf/layout/layout.factor
extra/pdf/pdf.factor
extra/pdf/streams/streams.factor
extra/robots/robots.factor
extra/shell/shell.factor
extra/subrip-subtitles/subrip-subtitles.factor
extra/text-to-pdf/text-to-pdf.factor
extra/text-to-pdf/text-to-pdf.pdf
extra/txon/txon.factor
extra/webapps/wiki/wiki.factor
extra/wikipedia/wikipedia.factor
extra/wolfram-alpha/wolfram-alpha.factor
misc/vim/syntax/factor/generated.vim

index 268e32470e625a414856d498e597cae2b6548788..80ed054bcf3ca18ca0c8c07c62b7326bfca858b8 100644 (file)
@@ -97,7 +97,7 @@ gc
     "." write flush
 
     {
-        lines prefix suffix unclip new-assoc assoc-union!
+        read-lines prefix suffix unclip new-assoc assoc-union!
         word-prop set-word-prop 1array 2array 3array ?nth
     } compile-unoptimized
 
index fa11caa0cf4d2d198d22126b034b1f25a32c473f..e554e2aade218d2b4dc9c85bf3804bee359fef75 100644 (file)
@@ -8,7 +8,7 @@ CONSTANT: url URL" http://downloads.factorcode.org/images/master/"
 
 : download-checksums ( -- alist )
     url "checksums.txt" >url derive-url http-get nip
-    string-lines [ " " split1 ] { } map>assoc ;
+    lines [ " " split1 ] { } map>assoc ;
 
 : file-checksum ( image -- checksum )
     md5 checksum-file bytes>hex-string ;
index f7705f09b4227eab4195a1d823f8794625e82a49..016f49963fc5d7a3438c1daa693a24046cb6daa9 100644 (file)
@@ -94,7 +94,7 @@ M: integer year.
         [
             [ month-name 20 center. ]
             [ days-header. days. nl nl ] bi
-        ] with-string-writer string-lines
+        ] with-string-writer lines
     ] with map 3 <groups>
     [ first3 [ "%-20s  %-20s  %-20s\n" printf ] 3each ] each ;
 
index 8beed6324bf9170b4886706a3e9c4cc0c22e6efa..b435a2337587566a5b592314742bf5f47f1aebec 100644 (file)
@@ -109,7 +109,7 @@ CONSTANT: doc-start { 0 0 }
     [ t >>inside-undo? ] dip keep f >>inside-undo? drop ; inline
 
 : split-lines ( str -- seq )
-    [ string-lines ] keep ?last
+    [ lines ] keep ?last
     [ "\r\n" member? ] [ t ] if*
     [ "" suffix ] when ;
 
index 3ec35209ecdd039fb9425d6835c47c64297d602f..136e4992b24b330b60fefa327c81c06ee7aee275 100644 (file)
@@ -91,4 +91,4 @@ M: sequence sha1-escape-strings ( seq -- strs )
     [ sha1-escape-string ] { } map-as ;
 
 M: string sha1-escape-strings ( str -- strs )
-    string-lines sha1-escape-strings ;
\ No newline at end of file
+    lines sha1-escape-strings ;
\ No newline at end of file
index a2166cfa4cebca8c7a7e599246afc458cc81d278..eb8a23e70e6414f26d5c253f3ec3c587caf91c54 100644 (file)
@@ -6,7 +6,7 @@ parser.notes splitting ;
 IN: eval
 
 : parse-string ( str -- quot )
-    [ string-lines parse-lines ] with-compilation-unit ;
+    [ lines parse-lines ] with-compilation-unit ;
 
 : (eval) ( str effect -- )
     [ parse-string ] dip call-effect ; inline
index 4107bb7d16bead719fc8e6bf52850d98b9326df3..3d4587b76293f609ff012daf521435f391591b85 100644 (file)
@@ -203,7 +203,7 @@ DEFER: (parse-paragraph)
     } case ;
 
 : parse-farkup ( string -- farkup )
-    string-lines [ dup empty? not ] [ parse-item ] produce nip sift ;
+    lines [ dup empty? not ] [ parse-item ] produce nip sift ;
 
 CONSTANT: invalid-url "javascript:alert('Invalid URL in farkup');"
 
@@ -217,7 +217,7 @@ CONSTANT: invalid-url "javascript:alert('Invalid URL in farkup');"
     } cond ;
 
 : render-code ( string mode -- xml )
-    [ string-lines ] dip htmlize-lines
+    [ lines ] dip htmlize-lines
     [XML <pre><-></pre> XML] ;
 
 GENERIC: (write-farkup) ( farkup -- xml )
index 0459518853a73b792517e46f55c362204a849bb1..72f1ad542028654ee74ff7eee24609b14f632144 100644 (file)
@@ -180,7 +180,7 @@ M: ftp-list handle-passive-command
     start-directory [
         utf8 encode-output [
             "." directory.
-        ] with-string-writer string-lines
+        ] with-string-writer lines
         harvest [ ftp-send ] each
     ] with-output-stream finish-directory ;
 
index 3f3c986b4ae690071c6f61d0b68724da30ceece8..494d2c1294355c3b4b2b568278d0528d83fc409d 100644 (file)
@@ -79,7 +79,7 @@ IN: help.syntax
     ] produce nip ;
 
 : code-lines ( str -- seq )
-    string-lines [ [ blank? ] trim ] map harvest ;
+    lines [ [ blank? ] trim ] map harvest ;
 
 : make-example ( str -- seq )
     code-lines dup { [ array? ] [ length 1 > ] } 1&& [
index 46872111d0b45fa3a659eaadb594f4bf11a7e0dc..1ccbba89e485f93ada3e57e29db71b31834693fc 100644 (file)
@@ -150,11 +150,11 @@ TUPLE: code mode ;
 : <code> ( -- code )
     code new ;
 
-: ?string-lines ( str/f -- seq )
-    [ { } ] [ string-lines ] if-empty ;
+: ?lines ( str/f -- seq )
+    [ { } ] [ lines ] if-empty ;
 
 M: code render*
-    [ ?string-lines ] [ drop ] [ mode>> value ] tri* htmlize-lines ;
+    [ ?lines ] [ drop ] [ mode>> value ] tri* htmlize-lines ;
 
 ! Farkup component
 TUPLE: farkup no-follow disable-images parsed ;
index 768bc41ea422e7861a8e88e95297efc0f1d927ba..6713facbadc197d1b89aca22f976a53bda949627 100644 (file)
@@ -58,7 +58,7 @@ SYNTAX: %> lexer get parse-%> ;
         [
             parser-quiet? on
             "html.templates.fhtml" use-vocab
-            string-lines parse-template-lines
+            lines parse-template-lines
         ] with-file-vocabs
     ] with-compilation-unit ;
 
index 0d136bc63c309277f2ef20b2dd118793e01489b3..11a9ae186e244e9e5e376d5b10fcfc1e0d8ab740 100644 (file)
@@ -66,7 +66,7 @@ ${ read-request-test-1' } [
     [ read-request ] with-string-reader
     [ write-request ] with-string-writer
     ! normalize crlf
-    string-lines "\n" join
+    lines "\n" join
 ] unit-test
 
 STRING: read-request-test-2
@@ -165,7 +165,7 @@ ${ read-response-test-1' } [
     [ read-response ] with-string-reader
     [ write-response ] with-string-writer
     ! normalize crlf
-    string-lines "\n" join
+    lines "\n" join
 ] unit-test
 
 { t } [
index 65bf509e41026adf62ab0ef77a6d6cf67d0f52c2..60628b71bcb6db48658df43a79dddf70412295c3 100644 (file)
@@ -237,7 +237,7 @@ HELP: with-process-reader
 { $examples
   { $unchecked-example
     "USING: io.launcher prettyprint io.encodings.utf8 ;"
-    "\"ls -dl /etc\" utf8 [ contents ] with-process-reader ."
+    "\"ls -dl /etc\" utf8 [ read-contents ] with-process-reader ."
     "\"drwxr-xr-x 213 root root 12288 mar 11 18:52 /etc\\n\""
   }
 } ;
index 13576e9fb38a61380c1fc06785ec57ddb2041f2e..08d3bb6e2c06a2e08ac7fc6866ee6efa3d9bdd6c 100644 (file)
@@ -158,7 +158,7 @@ SYMBOLS: out-path err-path ;
     launcher-test-path [
         <process>
             console-vm-path "-script" "env.factor" 3array >>command
-        utf8 [ contents ] with-process-reader
+        utf8 [ read-contents ] with-process-reader
     ] with-directory eval( -- alist )
 
     os-envs =
@@ -170,7 +170,7 @@ SYMBOLS: out-path err-path ;
             console-vm-path "-script" "env.factor" 3array >>command
             +replace-environment+ >>environment-mode
             os-envs >>environment
-        utf8 [ contents ] with-process-reader
+        utf8 [ read-contents ] with-process-reader
     ] with-directory eval( -- alist )
 
     os-envs =
@@ -181,7 +181,7 @@ SYMBOLS: out-path err-path ;
         <process>
             console-vm-path "-script" "env.factor" 3array >>command
             { { "A" "B" } } >>environment
-        utf8 [ contents ] with-process-reader
+        utf8 [ read-contents ] with-process-reader
     ] with-directory eval( -- alist )
 
     "A" of
@@ -193,7 +193,7 @@ SYMBOLS: out-path err-path ;
             console-vm-path "-script" "env.factor" 3array >>command
             { { "USERPROFILE" "XXX" } } >>environment
             +prepend-environment+ >>environment-mode
-        utf8 [ contents ] with-process-reader
+        utf8 [ read-contents ] with-process-reader
     ] with-directory eval( -- alist )
 
     "USERPROFILE" of "XXX" =
index 643776107914e9712d8d8bbb10947c8d03b1b806..ccd4da8a538d64fa29934cee51bbfef4d5c9817d 100644 (file)
@@ -104,22 +104,22 @@ namespaces strings tools.test ;
 
 { "asdf" } [
     "asdf" <string-reader> 2 <limited-stream> [
-        unlimited-input contents
+        unlimited-input read-contents
     ] with-input-stream
 ] unit-test
 
 { "asdf" } [
     "asdf" <string-reader> 2 <limited-stream> [
-        [ contents ] with-unlimited-input
+        [ read-contents ] with-unlimited-input
     ] with-input-stream
 ] unit-test
 
 { "gh" } [
     "asdfgh" <string-reader> 4 <limited-stream> [
         2 [
-            [ contents drop ] with-unlimited-input
+            [ read-contents drop ] with-unlimited-input
         ] with-limited-input
-        [ contents ] with-unlimited-input
+        [ read-contents ] with-unlimited-input
     ] with-input-stream
 ] unit-test
 
index 82bf549f535c456ff8014d44c81a126645f5f81c..0632a76b9409a0aee1b73d79d0b03c8fab4bb7b1 100644 (file)
@@ -1,7 +1,7 @@
 USING: io.streams.string io kernel arrays namespaces make
 tools.test ;
 
-{ "" } [ "" [ contents ] with-string-reader ] unit-test
+{ "" } [ "" [ read-contents ] with-string-reader ] unit-test
 
 { "line 1" CHAR: l }
 [
@@ -10,11 +10,11 @@ tools.test ;
 unit-test
 
 { { "line 1" "line 2" "line 3" } } [
-    "line 1\nline 2\nline 3" [ lines ] with-string-reader
+    "line 1\nline 2\nline 3" [ read-lines ] with-string-reader
 ] unit-test
 
 { { "" "foo" "bar" "baz" } } [
-    "\rfoo\r\nbar\rbaz\n" [ lines ] with-string-reader
+    "\rfoo\r\nbar\rbaz\n" [ read-lines ] with-string-reader
 ] unit-test
 
 { f } [ "" [ readln ] with-string-reader ] unit-test
index 62cd2f82b32cf5ba0f99abb93da6453754c01102..a6633f84d0f83d6af0801362dd61c937203bee3a 100644 (file)
@@ -46,7 +46,7 @@ ERROR: bad-log-message-parameters msg word level ;
     check-log-message
     log-service get
     2dup [ log? ] [ ] bi* and [
-        [ [ string-lines ] [ name>> ] [ name>> ] tri* ] dip
+        [ [ lines ] [ name>> ] [ name>> ] tri* ] dip
         4array "log-message" send-to-log-server
     ] [
         4drop
index 6ffcd2afc6615152d0e792b1dd801b579c2a7d70..f808cbdde0ceb9c6dedcdf97157b1a453df0661c 100644 (file)
@@ -33,7 +33,7 @@ C: <mime-variable> mime-variable
     >byte-array write ;
 
 : parse-headers ( string -- hashtable )
-    string-lines harvest [ parse-header-line ] map >hashtable ;
+    lines harvest [ parse-header-line ] map >hashtable ;
 
 : fill-bytes ( multipart -- multipart )
     buffer-size read
index 1b1208b991838d5a5b47c8f116023771a209893f..5ba1de3373d1f47e559b433900eb3ce178586f9e 100644 (file)
@@ -488,7 +488,7 @@ ERROR: bad-effect quot effect ;
     H{
         { "dup" dup } { "nip" nip } { "over" over } ! kernel
         { "nth" nth } ! sequences
-    } [ string-lines parse-lines ] with-words ;
+    } [ lines parse-lines ] with-words ;
 
 M: ebnf-action (transform)
     ebnf-transform check-action-effect action ;
index 2e51891fbbffced1f4ab2a6eb8fdca2839874d83..54ca5fea88ecd44b8ae6d59c6c0f483c6bf1c526 100644 (file)
@@ -24,7 +24,7 @@ and we didn't know hów tö do thât" latin2 encode >quoted ] unit-test
     55 [ "hello" ] replicate concat ;
 
 { f } [ message >quoted "=\r\n" swap subseq? ] unit-test
-{ 1 } [ message >quoted string-lines length ] unit-test
+{ 1 } [ message >quoted lines length ] unit-test
 { t } [ message >quoted-lines "=\r\n" swap subseq? ] unit-test
-{ 4 } [ message >quoted-lines string-lines length ] unit-test
-{ "===o" } [ message >quoted-lines string-lines [ last ] "" map-as ] unit-test
+{ 4 } [ message >quoted-lines lines length ] unit-test
+{ "===o" } [ message >quoted-lines lines [ last ] "" map-as ] unit-test
index 8a271e42eaa92e4123b526e3b62ab09d45d88dd8..01d0c49e9bb56f5c5aa3195c3527dafff890eaa3 100644 (file)
@@ -94,7 +94,7 @@ PRIVATE>
     [ parse-resolv.conf-line ] each ;
 
 : string>resolv.conf ( string -- resolv.conf )
-    string-lines lines>resolv.conf ;
+    lines lines>resolv.conf ;
 
 : path>resolv.conf ( path -- resolv.conf )
     utf8 file-lines lines>resolv.conf ;
index 8fe5710102f92d428a4171309390875f55938811..c3e5aca1cbe648df29c14b57f0ed7e7167d8b812 100644 (file)
@@ -14,7 +14,7 @@ IN: strings.tables
 PRIVATE>
 
 : format-table ( table -- seq )
-    [ [ string-lines ] map format-row flip ] map concat flip
+    [ [ lines ] map format-row flip ] map concat flip
     [ { } ] [
         [ but-last-slice [ format-column ] map! drop ] keep
         flip [ " " join ] map!
index c9ecac3b0a627f09e0ffa1f5fa91b1f8bdafb50a..908e479cbc8ad910af0583c41b5b0f1f9115856f 100644 (file)
@@ -14,7 +14,7 @@ IN: tools.deploy.config.editor
     parse-fresh [ first assoc-union ] unless-empty ;
 
 : set-deploy-config ( assoc vocab -- )
-    [ [ unparse-use ] without-limits string-lines ] dip
+    [ [ unparse-use ] without-limits lines ] dip
     "deploy.factor" set-vocab-file-lines ;
 
 : set-deploy-flag ( value key vocab -- )
index d4a0cd03e4950dfe6bcf6b1d1c8f683651b9e29c..7ba544392fb01c56feb15d1b7a572a1c370a420f 100644 (file)
@@ -22,7 +22,7 @@ PREDICATE: string-array < array [ string? ] all? ;
 PRIVATE>
 
 : ?string-lines ( string -- string/array )
-    CHAR: \n over member-eq? [ string-lines ] when ;
+    CHAR: \n over member-eq? [ lines ] when ;
 
 M: label string<<
     [
index db685b64e4a39239a71f5543902a1fec06b6e1e0..fd9550e9490cd6375d9c6a8f98981366b734fcd6 100644 (file)
@@ -71,7 +71,7 @@ M: f cell-dim 2drop 0 0 0 ;
 M: f draw-cell 2drop ;
 
 : single-line ( str -- str' )
-    dup [ "\r\n" member? ] any? [ string-lines " " join ] when ;
+    dup [ "\r\n" member? ] any? [ lines " " join ] when ;
 
 M: string cell-dim single-line text-dim first2 ceiling 0 ;
 M: string draw-cell single-line draw-text ;
index b2fa139c8e90bff0a407175ec65aefe3c6c90fff..c5d2a5e7ecab167027b952637b430cddc8fb53e6 100644 (file)
@@ -19,7 +19,7 @@ IN: unicode.collation.tests
 
 : collation-test-lines ( -- lines )
     "vocab:unicode/UCA/CollationTest_SHIFTED.txt.zip"
-    binary file-contents uncompress utf8 decode string-lines
+    binary file-contents uncompress utf8 decode lines
     [ "#" head? ] reject harvest ;
 
 : parse-collation-test-shifted ( -- lines )
index 4cab77531041b411b848d607df9c4a1335170cc3..6b5dc5b498101c00200b7b28591bf5aefb690f69 100644 (file)
@@ -15,7 +15,7 @@ IN: vocabs.platforms
 
 : parse-platform-section ( string suffix -- )
     [
-        [ [ string-lines parse-lines ] curry with-nested-compilation-unit ]
+        [ [ lines parse-lines ] curry with-nested-compilation-unit ]
         curry
     ] dip with-vocabulary drop ; inline
 
index bcc49ac8949d59d257f46aea4a9318aaa9664157..46e8b792b7909699bbf691bf5cb0f1566ffffe07 100644 (file)
@@ -12,7 +12,7 @@ IN: wrap.strings
     swap [ 0 over length <element> prefix ] when* ;
 
 : split-lines ( string -- elements-lines )
-    string-lines [ split-line ] map! ;
+    lines [ split-line ] map! ;
 
 : join-elements ( wrapped-lines -- lines )
     [ " " join ] map! ;
index e98b8af10a55d69454c613df4b24b3b4de028671..3faffc0078759cb6700df9532dfb37aca1f40f21 100644 (file)
@@ -6,7 +6,7 @@ splitting memoize kernel io.streams.string xml.writer ;
 { } [
     "<style type=\"text/css\" media=\"screen\" >
     *        {margin:0; padding:0; border:0;}"
-    string-lines "html" htmlize-lines drop
+    lines "html" htmlize-lines drop
 ] unit-test
 
 { } [
index 75e8ed3b4f9f334298972108bd98be9bee6e79fb..5a7e8a4eb0c70f806c96226688098f436367a014 100644 (file)
@@ -70,5 +70,5 @@ M: vocab highlight.
     vocab-source-path highlight. ;
 
 M: word highlight.
-    [ see ] with-string-writer string-lines
+    [ see ] with-string-writer lines
     "factor" highlight-lines ;
index 50a608ed1d3296f6e2e8c669e78981c89739cc51..5d7d07bb3e2b2427676642a240a3f79c135b7b09 100644 (file)
@@ -206,7 +206,7 @@ TUPLE: computer cpu ram ;
 C: <computer> computer
 
 { "TUPLE: computer cpu ram ;" } [
-    [ \ computer see ] with-string-writer string-lines second
+    [ \ computer see ] with-string-writer lines second
 ] unit-test
 
 TUPLE: laptop < computer battery ;
@@ -231,7 +231,7 @@ C: <laptop> laptop
 test-laptop-slot-values
 
 { "TUPLE: laptop < computer battery ;" } [
-    [ \ laptop see ] with-string-writer string-lines second
+    [ \ laptop see ] with-string-writer lines second
 ] unit-test
 
 { { tuple computer laptop } } [ laptop superclasses-of ] unit-test
@@ -268,7 +268,7 @@ test-server-slot-values
 { f } [ \ + server? ] unit-test
 
 { "TUPLE: server < computer rackmount ;" } [
-    [ \ server see ] with-string-writer string-lines second
+    [ \ server see ] with-string-writer lines second
 ] unit-test
 
 [
index c9cb248925ee652a03d827c927c07051b1454cd2..91fba6bfafa2036479bd83817fff4c89f4f2f6c3 100644 (file)
@@ -301,7 +301,7 @@ HELP: stream-lines
 { $values { "stream" "an input stream" } { "seq" { $sequence string } } }
 { $description "Reads lines of text until the stream is exhausted, collecting them in a sequence of strings." } ;
 
-HELP: lines
+HELP: read-lines
 { $values { "seq" { $sequence string } } }
 { $description "Reads lines of text until from the " { $link input-stream } " until it is exhausted, collecting them in a sequence of strings." } ;
 
@@ -318,7 +318,7 @@ HELP: stream-contents
 { $description "Reads all elements in the given stream until the stream is exhausted. The type of the sequence depends on the stream's element type. The stream is closed after completion." }
 $io-error ;
 
-HELP: contents
+HELP: read-contents
 { $values { "seq" { $or string byte-array } } }
 { $description "Reads all elements in the " { $link input-stream } " until the stream is exhausted. The type of the sequence depends on the stream's element type." }
 $io-error ;
@@ -476,13 +476,13 @@ $nl
 "Processing lines one by one:"
 { $subsections
     stream-lines
-    lines
+    read-lines
     each-line
 }
 "Processing blocks of data:"
 { $subsections
     stream-contents
-    contents
+    read-contents
     each-block
 }
 "Copying the contents of one stream to another:"
index 9d20471b29ee0adf644f6cd1cd4e08771f175326..fc6c206e22e1a39f0f75fa02c4b5831660f134a1 100644 (file)
@@ -163,7 +163,8 @@ ERROR: invalid-read-buffer buf stream ;
         [ ] collector [ each-stream-line ] dip { } like
     ] with-disposal ; inline
 
-: lines ( -- seq )
+! Note: was `lines` before .99
+: read-lines ( -- seq )
     input-stream get stream-lines ; inline
 
 CONSTANT: each-block-size 65536
@@ -209,9 +210,11 @@ CONSTANT: each-block-size 65536
         [ stream-exemplar produce-as nip ] bi
     ] with-disposal ; inline
 
-: contents ( -- seq )
+: read-contents ( -- seq )
     input-stream get stream-contents ; inline
 
+ALIAS: contents read-contents
+
 : stream-copy* ( in out -- )
     [ stream-write ] curry each-stream-block ; inline
 
index 1fe296f90a739f8c589ccf0745300bae5f11c9c7..37dc8e205df59ee85c870df3d07845b6fc9b8877 100644 (file)
@@ -3,7 +3,7 @@ io.encodings.binary io.encodings.utf8 io.streams.byte-array
 kernel math specialized-arrays strings tools.test ;
 SPECIALIZED-ARRAY: int
 
-{ B{ } } [ B{ } binary [ contents ] with-byte-reader ] unit-test
+{ B{ } } [ B{ } binary [ read-contents ] with-byte-reader ] unit-test
 
 ! Issue #70 github
 { f } [ B{ } binary [ 0 read ] with-byte-reader ] unit-test
index d69338c5ee40cf1ab8e5291472be42d0fd09ba95..0723299692975b2ee85081597458fd4ac1840e7b 100644 (file)
@@ -21,7 +21,7 @@ ARTICLE: "sequences-split" "Splitting sequences"
     split-when-slice
 }
 "Splitting a string into lines:"
-{ $subsections string-lines }
+{ $subsections lines }
 "Replacing subsequences with another subsequence:"
 { $subsections replace } ;
 
@@ -94,11 +94,11 @@ HELP: ?tail-slice
 { $values { "seq" sequence } { "end" sequence } { "newseq" slice } { "?" boolean } }
 { $description "Like " { $link ?tail } ", except the resulting sequence is a " { $link slice } "." } ;
 
-HELP: string-lines
+HELP: lines
 { $values { "seq" sequence } { "seq'" { $sequence string } } }
 { $description "Splits a string along line breaks." }
 { $examples
-    { $example "USING: prettyprint splitting ;" "\"Hello\\r\\nworld\\n\" string-lines ." "{ \"Hello\" \"world\" }" }
+    { $example "USING: prettyprint splitting ;" "\"Hello\\r\\nworld\\n\" lines ." "{ \"Hello\" \"world\" }" }
 } ;
 
 HELP: replace
index 875f8061fd4e052e558dcbe2384d93a7cac3b3e9..7285ce20df9dfa35bc82d7bc2121403e05907713 100644 (file)
@@ -45,31 +45,31 @@ unit-test
 { "" t } [ "\n" "\n" ?tail ] unit-test
 { "" f } [ "" "\n" ?tail ] unit-test
 
-{ { } } [ "" string-lines ] unit-test
-{ { "" } } [ "\n" string-lines ] unit-test
-{ { "" } } [ "\r" string-lines ] unit-test
-{ { "" } } [ "\r\n" string-lines ] unit-test
-{ { "hello" } } [ "hello" string-lines ] unit-test
-{ { "hello" } } [ "hello\n" string-lines ] unit-test
-{ { "hello" } } [ "hello\r" string-lines ] unit-test
-{ { "hello" } } [ "hello\r\n" string-lines ] unit-test
-{ { "hello" "hi" } } [ "hello\nhi" string-lines ] unit-test
-{ { "hello" "hi" } } [ "hello\rhi" string-lines ] unit-test
-{ { "hello" "hi" } } [ "hello\r\nhi" string-lines ] unit-test
-{ { "hello" "" "" } } [ "hello\n\n\n" string-lines ] unit-test
-
-{ { } } [ SBUF" " string-lines ] unit-test
-{ { "" } } [ SBUF" \n" string-lines ] unit-test
-{ { "" } } [ SBUF" \r" string-lines ] unit-test
-{ { "" } } [ SBUF" \r\n" string-lines ] unit-test
-{ { "hello" } } [ SBUF" hello" string-lines ] unit-test
-{ { "hello" } } [ SBUF" hello\n" string-lines ] unit-test
-{ { "hello" } } [ SBUF" hello\r" string-lines ] unit-test
-{ { "hello" } } [ SBUF" hello\r\n" string-lines ] unit-test
-{ { "hello" "hi" } } [ SBUF" hello\nhi" string-lines ] unit-test
-{ { "hello" "hi" } } [ SBUF" hello\rhi" string-lines ] unit-test
-{ { "hello" "hi" } } [ SBUF" hello\r\nhi" string-lines ] unit-test
-{ { "hello" "" "" } } [ SBUF" hello\n\n\n" string-lines ] unit-test
+{ { } } [ "" lines ] unit-test
+{ { "" } } [ "\n" lines ] unit-test
+{ { "" } } [ "\r" lines ] unit-test
+{ { "" } } [ "\r\n" lines ] unit-test
+{ { "hello" } } [ "hello" lines ] unit-test
+{ { "hello" } } [ "hello\n" lines ] unit-test
+{ { "hello" } } [ "hello\r" lines ] unit-test
+{ { "hello" } } [ "hello\r\n" lines ] unit-test
+{ { "hello" "hi" } } [ "hello\nhi" lines ] unit-test
+{ { "hello" "hi" } } [ "hello\rhi" lines ] unit-test
+{ { "hello" "hi" } } [ "hello\r\nhi" lines ] unit-test
+{ { "hello" "" "" } } [ "hello\n\n\n" lines ] unit-test
+
+{ { } } [ SBUF" " lines ] unit-test
+{ { "" } } [ SBUF" \n" lines ] unit-test
+{ { "" } } [ SBUF" \r" lines ] unit-test
+{ { "" } } [ SBUF" \r\n" lines ] unit-test
+{ { "hello" } } [ SBUF" hello" lines ] unit-test
+{ { "hello" } } [ SBUF" hello\n" lines ] unit-test
+{ { "hello" } } [ SBUF" hello\r" lines ] unit-test
+{ { "hello" } } [ SBUF" hello\r\n" lines ] unit-test
+{ { "hello" "hi" } } [ SBUF" hello\nhi" lines ] unit-test
+{ { "hello" "hi" } } [ SBUF" hello\rhi" lines ] unit-test
+{ { "hello" "hi" } } [ SBUF" hello\r\nhi" lines ] unit-test
+{ { "hello" "" "" } } [ SBUF" hello\n\n\n" lines ] unit-test
 
 { { "hey" "world" "what's" "happening" } }
 [ "heyAworldBwhat'sChappening" [ LETTER? ] split-when ] unit-test
index 464d1a3fc932a0abec4ca08a353b5f1e828734e0..50b2a92df4c5ec76d4071ff8c8a153ee05e99842 100644 (file)
@@ -102,12 +102,14 @@ PRIVATE>
         [ pick subseq ] keep swap
     ] map 2nip ;
 
-! string-lines uses string-nth-fast which is 50% faster over
+! lines uses string-nth-fast which is 50% faster over
 ! nth-unsafe. be careful when changing the definition so that
 ! you don't unoptimize it.
-GENERIC: string-lines ( seq -- seq' )
+GENERIC: lines ( seq -- seq' )
 
-M: string string-lines
+ALIAS: string-lines lines
+
+M: string lines
     [ V{ } clone 0 ] dip [ 2dup bounds-check? ] [
         2dup [ "\r\n" member? ] find-from swapd [
             over [ [ nip length ] keep ] unless
@@ -117,4 +119,7 @@ M: string string-lines
         ] when
     ] while 2drop { } like ;
 
-M: sbuf string-lines "" like string-lines ;
+M: sbuf lines "" like lines ;
+
+: unlines-as ( seq exemplar -- seq ) "\n" swap join-as ; inline
+: unlines ( seq -- seq ) "" unlines-as ; inline
index dc0643316fafe8118b3d802e2a30ad518923c53a..82d5a682856f8dbe2cc01edb1f25ca52bb7881b6 100644 (file)
@@ -7,5 +7,5 @@ IN: backticks
 SYNTAX: `
     "`" parse-multiline-string '[
         _ interpolate>string
-        utf8 [ contents ] with-process-reader
+        utf8 [ read-contents ] with-process-reader
     ] append! ;
index 59ce890bb83ce1b8910dccc6ee4ebb5b8cf62df5..21614a7bfc96e5f52f26e3fe3e43e79d125c06a3 100644 (file)
@@ -24,7 +24,7 @@ FROM: compiler.cfg.linearization => number-blocks ;
 IN: compiler.cfg.graphviz
 
 : left-justify ( str -- str' )
-    string-lines "\\l" join ;
+    lines "\\l" join ;
 
 : left-justified ( quot -- str )
     with-string-writer left-justify ; inline
index 45b15920be04e6c2dbd0afeb92a31024136fc868..34b1fa0af21933612dbfa998b9fc0313299a8a49 100644 (file)
@@ -78,7 +78,7 @@ CONSTANT: URL V{ }
 : gemini-print ( url body meta -- )
     f pre [
         PAGE delete-all
-        gemini-charset decode string-lines [
+        gemini-charset decode lines [
             { [ pre get not ] [ "=>" ?head ] } 0&& [
                 swap gemini-link present over 2array PAGE push
                 PAGE length swap "[%s] %s\n" printf
index 8984de2202b8502bc7c5abb7c6d4eada5541f5df..d7612689c7f2cc42e816c5e18d77c3066d13fdec 100644 (file)
@@ -191,4 +191,4 @@ CONSTANT: text-style H{ { font-size 12 } { font-style plain } }
 PRIVATE>
 
 : gemtext. ( base-url body -- )
-    f pre [ string-lines [ gemini-line. ] with each ] with-variable ;
+    f pre [ lines [ gemini-line. ] with each ] with-variable ;
index f26d433151f0b47724ab7fe4247fb67af1295fc4..8f7a7780ee794b436b47f869cad917761920c731 100644 (file)
@@ -5,7 +5,7 @@ io.launcher io.streams.string kernel sequences tools.test ;
 IN: git.tests
 
 : run-process-stdout ( process -- string )
-    >process utf8 [ contents ] with-process-reader ;
+    >process utf8 [ read-contents ] with-process-reader ;
 
 : with-empty-test-git-repo ( quot -- )
     '[
index 61cc9a6f5a1362c0084181fbf4036fca693fbdf7..738c50725f327218a23051e2670ffcfcf55adfbc 100644 (file)
@@ -155,7 +155,7 @@ ERROR: unknown-field name parameter ;
 
 : git-string>assoc ( string -- assoc )
     "\n\n" split1 [
-        string-lines [ nip first CHAR: \s = ] monotonic-split
+        lines [ nip first CHAR: \s = ] monotonic-split
         [
             dup length 1 = [
                 first " " split1 2array
index 5820c784f7dd2db407dee277cc094b47726b7418..83a8dc106a095706947e7a1241181fae10bde41a 100644 (file)
@@ -88,7 +88,7 @@ M: gopher-link >url
     ] if ;
 
 : gopher-text ( object -- lines )
-    utf8 decode string-lines { "." } split1 drop ;
+    utf8 decode lines { "." } split1 drop ;
 
 : gopher-text. ( object -- )
     gopher-text [ print ] each ;
index 2c94a65d8001cf9a0f812661b872a002a97510d3..c6f0d59e187392a18cc6c97553d8f664f9c8282e 100644 (file)
@@ -5,5 +5,5 @@ tools.test ;
 IN: io.streams.counting.tests
 
 { 1306 0 } [
-    "resource:LICENSE.txt" utf8 <file-reader> [ contents ] with-counting-stream nipd
+    "resource:LICENSE.txt" utf8 <file-reader> [ read-contents ] with-counting-stream nipd
 ] unit-test
index e3ad04fadcd9b9c58578a44113b1de6c1c6f5097..4a2fc5071929244aa6047fc649736639097fa70f 100644 (file)
@@ -20,6 +20,6 @@ M: literate-lexer skip-blank
     ] [ call-next-method ] if ;
 
 SYNTAX: <LITERATE
-    "LITERATE>" parse-multiline-string string-lines [
+    "LITERATE>" parse-multiline-string lines [
         <literate-lexer> (parse-lines) append!
     ] with-nested-compilation-unit ;
index 43ca530341df79119d4e452bde68f58fc0d6ae24..2d38cb4c39717087b15c3dbe1f9e6f226cc1e44d 100644 (file)
@@ -23,7 +23,7 @@ C: <data-set> data-set
     utf8 file-contents ;
 
 : load-tabular-file ( name -- lines )
-    load-file [ blank? ] trim string-lines
+    load-file [ blank? ] trim lines
     [ [ blank? ] split-when harvest ] map harvest ;
 
 : numerify ( table -- data names )
index 6352404b0f696510d3f344fcd66c416a3a050b7d..1fc78adc4302c6edb75d488775187155faa066f4 100644 (file)
@@ -743,7 +743,7 @@ sky-condition raw ;
 
 : <taf-report> ( taf -- report )
     [ taf-report new ] dip [ >>raw ] keep
-    string-lines [ [ blank? ] trim ] map
+    lines [ [ blank? ] trim ] map
     rest dup first "TAF" = [ rest ] when
     harvest unclip swapd taf-body swap taf-partials ;
 
index 381d3afd15fb4f03731ee054a88a5cf3ef3add4b..5af515b73d62b4337788bd29a6941e54c8cba4d6 100644 (file)
@@ -108,7 +108,7 @@ M: p pdf-render
 
 M: p pdf-width
     [ style>> set-style ] keep
-    [ font>> ] [ string>> ] bi* string-lines
+    [ font>> ] [ string>> ] bi* lines
     [ dupd text-width ] map nip supremum ;
 
 
@@ -141,7 +141,7 @@ M: text pdf-render
 
 M: text pdf-width
     [ style>> set-style ] keep
-    [ font>> ] [ string>> ] bi* string-lines
+    [ font>> ] [ string>> ] bi* lines
     [ dupd text-width ] map nip supremum ;
 
 
index d2b32461df94930f4d0e1aa18334cf427239b28d..da99872e447f3cc295efe618dbb9234afd841a89 100644 (file)
@@ -6,7 +6,7 @@ USING: io.files io.styles kernel pdf.layout sequences splitting ;
 IN: pdf
 
 : text-to-pdf ( str -- pdf )
-    string-lines [
+    lines [
         H{ { font-name "monospace" } { font-size 10 } } <p>
     ] map pdf>string ;
 
index 9c9d5869cacf60853c94ab908613a5d85fee95ee..39efff65bab544c4fbef0792d99e25954056972e 100644 (file)
@@ -11,7 +11,7 @@ IN: pdf.streams
 ! FIXME: what about "proper" tab support?
 
 : string>texts ( string style -- seq )
-    [ string-lines ] dip '[ _ <text> 1array ] map
+    [ lines ] dip '[ _ <text> 1array ] map
     <br> 1array join ;
 
 PRIVATE>
index dc5db2c00c5248e72fb86eea56eab7e9226d5138..fad70fb34d964309cae9c51ae1dd85cb881080be 100644 (file)
@@ -32,7 +32,7 @@ visit-time request-rate crawl-delay unknowns ;
     >robots.txt-url http-get nip ;
 
 : normalize-robots.txt ( string -- sitemaps seq )
-    string-lines
+    lines
     [ [ blank? ] trim ] map
     [ "#" head? ] reject harvest
     [ ":" split1 [ [ blank? ] trim ] bi@ [ >lower ] dip  ] { } map>assoc
index 0bf34a52ce44841df68f543c6d866776c9469fd8..d4bb109966cc0071cc773e16ef4773b4c05136ee 100644 (file)
@@ -30,7 +30,7 @@ DEFER: expansion
 
 M: back-quoted-expr expand
   expr>> expr command>> expansion
-  utf8 [ contents ] with-process-reader
+  utf8 [ read-contents ] with-process-reader
   " \n" split harvest ;
 
 : expansion ( command -- command ) [ expand ] map flatten ;
index e20cf9140594d79a68e7e3d4b80d2d608a6aab12..0a8541b00d64930f2b9d510d0b947406e35e2088 100644 (file)
@@ -41,7 +41,7 @@ TUPLE: srt-chunk id begin-time end-time rect text ;
     [ parse-srt-chunk ] { } map-as ;
 
 : parse-srt-string ( seq -- seq' )
-    string-lines parse-srt-lines ;
+    lines parse-srt-lines ;
 
 : parse-srt-file ( path -- seq )
     utf8 file-lines parse-srt-lines ;
index d4f91b6ce63317bdb9719192a9e2fc4edd3d12f8..897d858a50d5e087edbc1435dcbc121bb4f26ff0 100644 (file)
@@ -109,7 +109,7 @@ IN: text-to-pdf
     ] { } make "\n" join ;
 
 : string>lines ( str -- lines )
-    "\t" split "    " join string-lines
+    "\t" split "    " join lines
     [ [ " " ] when-empty ] map ;
 
 : lines>pages ( lines -- pages )
index d5b74e870ae20733161dcb2252caf6eb87b26498..c8e37487806e6b978548e94566ae0bb61e20870c 100644 (file)
@@ -176,7 +176,7 @@ BT
 (    ] { } make "\\n" join ;)'
 ( )'
 (: string>lines \( str -- lines \))'
-(    "\\t" split "    " join string-lines)'
+(    "\\t" split "    " join lines)'
 (    [ [ " " ] when-empty ] map ;)'
 ( )'
 ET
index e04c7c1a3d2091a32b027c774691b9e0d2dac4d1..59b02a611f77d826aba82b82943693172d9154e0 100644 (file)
@@ -27,7 +27,7 @@ IN: txon
 DEFER: name/values
 
 : (parse-value) ( string -- values )
-    decode-value string-lines
+    decode-value lines
     [ "" ] [ dup length 1 = [ first ] when ] if-empty ;
 
 : parse-value ( string -- remain value )
index 5339a3d6546a7b98dce1eb4dce2b9eebcc703e61..385f0b8dba4b2ee88f6f87e47718a8da557bc004 100644 (file)
@@ -297,7 +297,7 @@ M: revision feed-entry-url id>> revision-url ;
                 [ "new" [ from-object ] nest-form ]
                 bi*
             ]
-            [ [ content>> string-lines ] bi@ lcs-diff "diff" set-value ]
+            [ [ content>> lines ] bi@ lcs-diff "diff" set-value ]
             2bi
         ] >>init
 
index f712f68395647702554fb7d0b424c94dec71125d..3e1d0c37319602184e004cf39f398d38b6c2ea23 100644 (file)
@@ -75,7 +75,7 @@ PRIVATE>
 : article. ( name -- )
     wikipedia-url http-get nip parse-html
     "content" find-by-id-between
-    html-text string-lines
+    html-text lines
     [ [ blank? ] trim ] map harvest [
         html-unescape 72 wrap-string print nl
     ] each ;
index 91a4c3b36b7ea3ea4227869b0b64e4a93d564e49..b00c27702c00cfac42ff704d0d0a4a2ee06e4295 100644 (file)
@@ -43,7 +43,7 @@ PRIVATE>
         [ "title" attr "%s:\n" printf ]
         [
             "plaintext" deep-tags-named [
-                children>string string-lines
+                children>string lines
                 [ "  %s\n" printf ] each
             ] each
         ] bi
index bd45f208b654daaea100ce42020691e3fd9b0fbb..cda2a58d2abeadcd584223ba29799608246cdf4c 100644 (file)
@@ -44,7 +44,7 @@ SynKeywordFactorWord factorWord_namespaces | syn keyword factorWord_namespaces c
 SynKeywordFactorWord factorWord_sequences | syn keyword factorWord_sequences contained 1sequence 2all? 2any? 2each 2each-from 2map 2map-as 2map-reduce 2reduce 2selector 2sequence 3append 3append-as 3each 3map 3map-as 3sequence 4sequence <iota> <repetition> <reversed> <slice> ?first ?last ?nth ?second ?set-nth accumulate accumulate! accumulate* accumulate*! accumulate*-as accumulate-as all? any? append append! append-as assert-sequence assert-sequence= assert-sequence? binary-reduce bounds-check bounds-check? bounds-error bounds-error? but-last but-last-slice cartesian-each cartesian-find cartesian-map cartesian-product cartesian-product-as change-nth check-slice clone-like collapse-slice collector collector-as collector-for collector-for-as concat concat-as copy count cut cut* cut-slice cut-slice* delete-all delete-slice drop-prefix each each-from each-index empty? exchange filter filter! filter-as find find-from find-index find-index-from find-last find-last-from first first2 first3 first4 flip follow fourth glue glue-as halves harvest head head* head-slice head-slice* head? if-empty immutable immutable-sequence immutable-sequence? immutable? index index-from indices infimum infimum-by insert-nth interleave iota iota? join join-as last last-index last-index-from length lengthen like longer longer? longest map map! map-as map-find map-find-last map-index map-index-as map-integers map-reduce map-sum max-length member-eq? member? midpoint@ min-length mismatch move new-like new-resizable new-sequence non-negative-integer-expected non-negative-integer-expected? none? nth nths pad-head pad-tail partition pop pop* prefix prepend prepend-as produce produce-as product push push-all push-either push-if reduce reduce-index reject reject! reject-as remove remove! remove-eq remove-eq! remove-nth remove-nth! repetition repetition? replace-slice replicate replicate-as rest rest-slice reverse reverse! reversed reversed? second selector selector-as sequence sequence-hashcode sequence= sequence? set-first set-fourth set-last set-length set-nth set-second set-third short shorten shorter shorter? shortest sift slice slice-error slice-error? slice? snip snip-slice subseq subseq-as subseq-start subseq-start-from subseq? suffix suffix! sum sum-lengths supremum supremum-by surround surround-as tail tail* tail-slice tail-slice* tail? third trim trim-head trim-head-slice trim-slice trim-tail trim-tail-slice unclip unclip-last unclip-last-slice unclip-slice unless-empty virtual-exemplar virtual-sequence virtual-sequence? virtual@ when-empty
 SynKeywordFactorWord factorWord_sets | syn keyword factorWord_sets contained ?adjoin ?delete adjoin adjoin-all adjoin-at all-unique? cardinality clear-set delete diff diff! duplicates fast-set gather in? intersect intersect! intersect-all intersects? members null? set set-like set= set? subset? union union! union-all within without
 SynKeywordFactorWord factorWord_sorting | syn keyword factorWord_sorting contained inv-sort-with natural-sort sort sort-keys sort-pair sort-values sort-with
-SynKeywordFactorWord factorWord_splitting | syn keyword factorWord_splitting contained ?head ?head-slice ?tail ?tail-slice replace split split-indices split-slice split-subseq split-when split-when-slice split1 split1-last split1-last-slice split1-slice split1-when split1-when-slice string-lines
+SynKeywordFactorWord factorWord_splitting | syn keyword factorWord_splitting contained ?head ?head-slice ?tail ?tail-slice replace split split-indices split-slice split-subseq split-when split-when-slice split1 split1-last split1-last-slice split1-slice split1-when split1-when-slice lines
 SynKeywordFactorWord factorWord_strings | syn keyword factorWord_strings contained 1string <string> >string resize-string string string?
 SynKeywordFactorWord factorWord_strings_parser | syn keyword factorWord_strings_parser contained bad-escape bad-escape? escape hex-escape name>char-hook next-escape parse-string unescape-string unicode-escape
 SynKeywordFactorWord factorWord_syntax | syn keyword factorWord_syntax contained " 'HS{ 'H{ '[ '{ ( : :: :> ; << <<<<<< <<<<<<< <PRIVATE ====== ======= >> >>>>>> >>>>>>> @ ALIAS: B B: BUILTIN: BV{ B{ C: CHAR: CONSTANT: CS{ C{ DEFER: ERROR: EXCLUDE: FORGET: FROM: GENERIC#: GENERIC: HOOK: HS{ H{ IDENTITY-MEMO: IDENTITY-MEMO:: IH{ IN: INSTANCE: INTERSECTION: M: M:: MACRO: MACRO:: MAIN: MATH: MEMO: MEMO:: MIXIN: M\ NAN: P" POSTPONE: PREDICATE: PRIMITIVE: PRIVATE> QUALIFIED-WITH: QUALIFIED: RENAME: SBUF" SINGLETON: SINGLETONS: SLOT: SYMBOL: SYMBOLS: SYNTAX: TUPLE: T{ UNION: UNUSE: USE: USING: V{ W{ [ [let [\| \ ] _ call( call-next-method delimiter deprecated execute( f final flushable foldable initial: inline intersection{ maybe{ not{ read-only recursive t t? union{ { }