]> gitweb.factorcode.org Git - factor.git/commitdiff
factor: use more split/join words
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 21 Dec 2021 00:01:12 +0000 (18:01 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 21 Dec 2021 00:06:24 +0000 (18:06 -0600)
27 files changed:
basis/compiler/tree/builder/builder-docs.factor
basis/db/postgresql/lib/lib.factor
basis/db/postgresql/postgresql.factor
basis/db/types/types.factor
basis/farkup/farkup.factor
basis/help/lint/checks/checks.factor
basis/help/topics/topics-tests.factor
basis/http/http-tests.factor
basis/io/crlf/crlf.factor
basis/io/launcher/launcher-docs.factor
basis/prettyprint/prettyprint-tests.factor
basis/resolv-conf/resolv-conf.factor
basis/tools/ps/linux/linux.factor
basis/ui/gadgets/editors/editors.factor
basis/unix/linux/proc/proc.factor
basis/vocabs/files/files-docs.factor
basis/xml/syntax/syntax-tests.factor
extra/benchmark/wrap/wrap.factor
extra/broadcast-server/broadcast-server.factor
extra/git/git.factor
extra/gpu/shaders/shaders.factor
extra/graphviz/graphviz-tests.factor
extra/math/text/english/english.factor
extra/metar/metar.factor
extra/path-finding/path-finding-tests.factor
extra/rosetta-code/align-columns/align-columns.factor
extra/visionect/visionect.factor

index 5f761be68153a4a66f1a1c6ffff45079bfee03b4..f2dbbd406f399adc99b313d934b399f3c845a980 100644 (file)
@@ -1,5 +1,5 @@
-USING: compiler.tree help.markup help.syntax literals quotations sequences
-stack-checker.errors words ;
+USING: compiler.tree help.markup help.syntax literals quotations
+sequences splitting stack-checker.errors words ;
 IN: compiler.tree.builder
 
 HELP: build-tree
@@ -23,7 +23,7 @@ HELP: build-sub-tree
             "    T{ #call { word * } { in-d V{ \"x\" 1 } } { out-d { 2 } } }"
             "    T{ #copy { in-d V{ 2 } } { out-d { \"y\" } } }"
             "}"
-        } "\n" join
+        } join-lines
     ]
   }
 } ;
index ebbc85dec3c4823641546da12cd9dc54417425c1..ad75d100b5e784973018698ca2257532344aec65 100644 (file)
@@ -21,7 +21,7 @@ IN: db.postgresql.lib
 
 : (postgresql-error-message) ( handle -- str )
     PQerrorMessage
-    "\n" split [ [ ascii:blank? ] trim ] map join-lines ;
+    split-lines [ [ ascii:blank? ] trim ] map join-lines ;
 
 : postgresql-error-message ( -- str )
     db-connection get handle>> (postgresql-error-message) ;
index 34baeba51c22f10f5bacb06f837d50e4f0c899f3..ebd132890011a16ce9ea5e085ac77cd4fa87fffd 100644 (file)
@@ -280,7 +280,7 @@ M: postgresql-db-connection compound
     } case ;
 
 M: postgresql-db-connection parse-db-error
-    "\n" split dup length {
+    split-lines dup length {
         { 1 [ first parse-postgresql-sql-error ] }
         { 2 [ concat parse-postgresql-sql-error ] }
         { 3 [
index 5932f4531eac525b7a792d0acc3def3db7bf1f0d..eea4d1dcaab1abb7f722b61ba3d05fc9ea413883 100644 (file)
@@ -1,10 +1,8 @@
 ! Copyright (C) 2008 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: arrays assocs db kernel math math.parser
-sequences continuations sequences.deep prettyprint
-words namespaces slots slots.private classes mirrors
-classes.tuple combinators calendar.format classes.singleton
-accessors quotations random db.private ;
+USING: accessors arrays assocs classes classes.tuple combinators
+db kernel math math.parser mirrors sequences sequences.deep
+splitting words ;
 IN: db.types
 
 HOOK: persistent-table db-connection ( -- hash )
@@ -139,7 +137,7 @@ ERROR: no-sql-type type ;
     ] if ;
 
 : modifiers ( spec -- string )
-    modifiers>> [ lookup-modifier ] map " " join
+    modifiers>> [ lookup-modifier ] map join-words
     [ "" ] [ " " prepend ] if-empty ;
 
 HOOK: bind% db-connection ( spec -- )
index 897f454e181b6e3f9571f1a57051b928fc78b7fd..494da659b40aa52189b805d5d2058c53f59b0ab5 100644 (file)
@@ -113,7 +113,7 @@ DEFER: (parse-paragraph)
         first delimiter split1 :> ( before after )
         before accum push
         after [
-            accum "\n" join
+            accum join-lines
             rest after prefix
         ] [
             rest delimiter accum (take-until)
index 2be0093a1e4d5939566d74b4d116e405d4444295..6c73369f36b9083c88cc3d036424e8f75d68663b 100644 (file)
@@ -51,7 +51,7 @@ SYMBOL: vocab-articles
     [
         '[
             _ rest [
-                but-last "\n" join
+                but-last join-lines
                 eval-with-stack
                 "\n" ?tail drop
             ] keep
index a62b43fb6ed433f28c797f99469d6e7a532e8585..a524ca6be59b22e55e8801cf03021f689a87f116 100644 (file)
@@ -1,6 +1,5 @@
-USING: accessors definitions help help.topics help.crossref
-help.markup help.syntax kernel sequences tools.test words parser
-namespaces assocs source-files eval ;
+USING: accessors assocs eval help help.markup help.topics
+namespaces source-files splitting tools.test ;
 IN: help.topics.tests
 
 ! Test help cross-referencing
@@ -21,7 +20,7 @@ SYMBOL: foo
         "ARTICLE: { \"test\" 1 } \"Hello\""
         "\"abc\""
         "\"def\" ;"
-    } "\n" join
+    } join-lines
     [
         "testfile" path>source-file current-source-file set
         eval( -- )
index b1b2508989fd698b071a38721a13cced79631bf9..ca9db152d4ca032959ce173b8821f176fd808428 100644 (file)
@@ -66,7 +66,7 @@ ${ read-request-test-1' } [
     [ read-request ] with-string-reader
     [ write-request ] with-string-writer
     ! normalize crlf
-    split-lines "\n" join
+    split-lines join-lines
 ] 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
-    split-lines "\n" join
+    split-lines join-lines
 ] unit-test
 
 { t } [
index 9ab6f7dff91aa1f9d787c74b2ff34e830beda0c1..43f6ae0cd6c6bc1515201bb27efc3b45deff8147 100644 (file)
@@ -27,7 +27,7 @@ IN: io.crlf
     CHAR: \r swap remove ;
 
 : lf>crlf ( str -- str' )
-    "\n" split "\r\n" join ;
+    split-lines "\r\n" join ;
 
 :: stream-read1-ignoring-crlf ( stream -- ch )
     stream stream-read1 dup "\r\n" member?
index 60628b71bcb6db48658df43a79dddf70412295c3..d8b64ef4f98aa5f29007bc1b59b784481bf6b34a 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2007, 2008 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: assocs calendar help.markup help.syntax io io.files
-io.launcher.private kernel literals quotations sequences ;
+io.launcher.private kernel literals quotations splitting ;
 IN: io.launcher
 
 ARTICLE: "io.launcher.command" "Specifying a command"
@@ -163,7 +163,7 @@ HELP: try-process
             "        }"
             "    }"
             "}"
-        } "\n" join
+        } join-lines
     ]
   }
 } ;
index 8f4c9771359cd8c3339d0197f340a124d82bd21d..3b550071b616868e94a8d3f3d1a2fa32afe3f203 100644 (file)
@@ -115,7 +115,7 @@ unit-test
             [ parse-fresh drop ] with-compilation-unit
             [
                 "prettyprint.tests" lookup-word see
-            ] with-string-writer "\n" split but-last
+            ] with-string-writer split-lines but-last
         ] keep =
     ] with-interactive-vocabs ;
 
@@ -151,7 +151,7 @@ M: object method-layout ;
         ""
     }
 } [
-    [ \ method-layout see-methods ] with-string-writer "\n" split
+    [ \ method-layout see-methods ] with-string-writer split-lines
 ] unit-test
 
 : soft-break-test ( -- str )
@@ -253,7 +253,7 @@ M: class-see-layout class-see-layout ;
         ""
     }
 } [
-    [ \ class-see-layout see ] with-string-writer "\n" split
+    [ \ class-see-layout see ] with-string-writer split-lines
 ] unit-test
 
 {
@@ -263,7 +263,7 @@ M: class-see-layout class-see-layout ;
         ""
     }
 } [
-    [ \ class-see-layout see-methods ] with-string-writer "\n" split
+    [ \ class-see-layout see-methods ] with-string-writer split-lines
 ] unit-test
 
 { } [ \ in>> synopsis drop ] unit-test
@@ -333,7 +333,7 @@ TUPLE: tuple-with-declared-slot { x integer } ;
         ""
     }
 } [
-    [ \ tuple-with-declared-slot see ] with-string-writer "\n" split
+    [ \ tuple-with-declared-slot see ] with-string-writer split-lines
 ] unit-test
 
 TUPLE: tuple-with-read-only-slot { x read-only } ;
@@ -345,7 +345,7 @@ TUPLE: tuple-with-read-only-slot { x read-only } ;
         ""
     }
 } [
-    [ \ tuple-with-read-only-slot see ] with-string-writer "\n" split
+    [ \ tuple-with-read-only-slot see ] with-string-writer split-lines
 ] unit-test
 
 TUPLE: tuple-with-initial-slot { x initial: 123 } ;
@@ -357,7 +357,7 @@ TUPLE: tuple-with-initial-slot { x initial: 123 } ;
         ""
     }
 } [
-    [ \ tuple-with-initial-slot see ] with-string-writer "\n" split
+    [ \ tuple-with-initial-slot see ] with-string-writer split-lines
 ] unit-test
 
 TUPLE: tuple-with-initial-declared-slot { x integer initial: 123 } ;
@@ -371,7 +371,7 @@ TUPLE: tuple-with-initial-declared-slot { x integer initial: 123 } ;
         ""
     }
 } [
-    [ \ tuple-with-initial-declared-slot see ] with-string-writer "\n" split
+    [ \ tuple-with-initial-declared-slot see ] with-string-writer split-lines
 ] unit-test
 
 TUPLE: final-tuple ; final
@@ -383,7 +383,7 @@ TUPLE: final-tuple ; final
         ""
     }
 } [
-    [ \ final-tuple see ] with-string-writer "\n" split
+    [ \ final-tuple see ] with-string-writer split-lines
 ] unit-test
 
 { "H{ { 1 2 } }\n" } [ [ H{ { 1 2 } } short. ] with-string-writer ] unit-test
index bbcbc623b3166f65d243c2d5d580a13d56b39a7b..efd548d68101065e819c1f59912d460e4a36794c 100644 (file)
@@ -35,7 +35,7 @@ CONSTRUCTOR: <resolv.conf> resolv.conf ( -- resolv.conf )
 : trim-blanks ( string -- string' ) [ blank? ] trim ;
 
 : split-line ( resolv.conf string -- resolv.conf seq resolv.conf )
-    trim-blanks " " split
+    trim-blanks split-words
     [ trim-blanks ] map harvest over ;
 
 : parse-nameserver ( resolv.conf string -- resolv.conf )
@@ -51,7 +51,7 @@ CONSTRUCTOR: <resolv.conf> resolv.conf ( -- resolv.conf )
     split-line search>> push-all ;
 
 : parse-sortlist ( resolv.conf string -- resolv.conf )
-    trim-blanks " " split
+    trim-blanks split-words
     [ trim-blanks "/" split1 <network> ] map >>sortlist ;
 
 ERROR: unsupported-resolv.conf-option string ;
index 56cc14637989e380888f5d68fc51f5db5f2f0933..d8dab2534d9a234c3a6372e5a1dedb584c159852 100644 (file)
@@ -11,7 +11,7 @@ IN: tools.ps.linux
         [ "()" member? ] trim
         "[" "]" surround
     ] [
-        nip "\0" split harvest " " join
+        nip "\0" split harvest join-words
     ] if-empty ;
 
 : safe-ps-cmdline ( path -- string/f )
index a5c4b26524eddc333b61965fb705fa598d4e30a0..29e7bbb0250e8ebc9db3ea278f79bedcb66211a7 100644 (file)
@@ -636,7 +636,7 @@ PRIVATE>
 <PRIVATE
 
 : join-lines ( string -- string' )
-    "\n" split
+    split-lines
     [ rest-slice [ [ blank? ] trim-head-slice ] map! drop ]
     [ but-last-slice [ [ blank? ] trim-tail-slice ] map! drop ]
     [ join-words ]
index de39780d5a145e0b85c37d812a89572dc6f9a740..a41f6807187b1caf3cdeef1548b7b91044503274 100644 (file)
@@ -208,7 +208,7 @@ TUPLE: proc-stat
 TUPLE: proc-cpu-stat name user nice system idle iowait irq softirq steal guest guest-nice ;
 
 : line>cpu ( string -- cpu )
-    " " split
+    split-words
     unclip-slice
     [ [ [ CHAR: \s = ] trim string>number ] map ] dip prefix
     [ proc-cpu-stat boa ] input<sequence ;
index a2c523e650f27ee5feb811e021a538992d9607df..1c4c4f5b8cced2651960bb2ce9ef9d2365abd445 100644 (file)
@@ -1,4 +1,5 @@
-USING: help.markup help.syntax literals sequences strings ;
+USING: help.markup help.syntax literals sequences splitting
+strings ;
 IN: vocabs.files
 
 HELP: vocab-tests-path
@@ -23,7 +24,7 @@ HELP: vocab-files
             "    \"resource:basis/alien/libraries/libraries-docs.factor\""
             "    \"resource:basis/alien/libraries/libraries-tests.factor\""
             "}"
-        } "\n" join
+        } join-lines
     ]
   }
 } ;
@@ -48,7 +49,7 @@ HELP: vocab-tests
             "    \"resource:basis/xml/tests/xmltest.factor\""
             "    \"resource:basis/xml/tests/xmode-dtd.factor\""
             "}"
-        } "\n" join
+        } join-lines
     ]
   }
 } ;
index f7fa4f2e6ac4bf70f8adfd983222b3b52e649a8b..08205a19cfef6a6706b40c8bb23d9ff164cbfe5a 100644 (file)
@@ -74,7 +74,7 @@ XML-NS: foo http://blah.com
     three
   </item>
 </doc>" } [
-    "one two three" " " split
+    "one two three" split-Words
     [ [XML <item><-></item> XML] ] map
     <XML <doc><-></doc> XML> pprint-xml>string
 ] unit-test
index ca8f1b215ff66e1e46e1459aaecde71478031161..0aa6d46a8af2045836f630b0863eaf0e6c3e43d3 100644 (file)
@@ -4,7 +4,7 @@ USING: kernel math math.parser sequences wrap wrap.strings ;
 IN: benchmark.wrap
 
 : wrap-benchmark ( -- )
-    1,000 <iota> [ number>string ] map " " join
+    1,000 <iota> [ number>string ] map join-words
     100 [ dup 80 wrap-string drop ] times drop ;
 
 MAIN: wrap-benchmark
index a5cf648256fe84516d2d0e2eebc1ea2c81bbe1d6..c5c80a6b0ef9ddf451439287778b0be74d98db18 100644 (file)
@@ -64,7 +64,7 @@ SINGLETONS: command data ;
             ] [
                 [
                     receive-socket>> receive
-                    [ utf8 decode "\n" split parse-lines ] dip
+                    [ utf8 decode split-lines parse-lines ] dip
                 ] keep handle-data t
             ] if
         ] loop
index 3c976bc1c126e8ce9b060f3ad5ac4a170fc744c0..81a2f3637ee02e64e86247c74b525c4ab5335c19 100644 (file)
@@ -137,7 +137,7 @@ CONSTRUCTOR: <tree> tree ( -- obj ) ;
         [ hash>> "commit " prepend print ]
         [ author>> "Author: " prepend split-words 2 head* join-words print ]
         [ author>> split-words git-date>string "Date:   " prepend print ]
-        [ message>> "\n" split [ "    " prepend ] map join-lines nl print nl ]
+        [ message>> split-lines [ "    " prepend ] map join-lines nl print nl ]
     } cleave ;
 
 ERROR: unknown-field name parameter ;
index 444b243eb16222643c995daf8ed32a8db3bee95f..fb48ed0897577901764f23fb684b281aaaa0381f 100644 (file)
@@ -330,7 +330,7 @@ SYMBOL: padding-no
     ] [ nip ] if ":" join ;
 
 : replace-log-line-numbers ( object log -- log' )
-    "\n" split harvest
+    split-lines harvest
     [ replace-log-line-number ] with map
     join-lines ;
 
index 03f4710f6f77ef97e6c4bf9d5461e1d21ec8c3ad..97be3991b5e088c59d40bb1b1e00b424d37aec0e 100644 (file)
@@ -17,7 +17,7 @@ IN: graphviz.tests
     ] [
         nip output>>
         "Use one of: " split1 nip "\n" ?tail drop
-        " " split
+        split-words
     ] recover ;
 
 ! http://www.graphviz.org/Download_macos.php#comment-474
index 41374474121336550e7ffe4eef59b51432775713..9a886c926ac94e5cd49062dad05a7e643ba31a70 100644 (file)
@@ -104,7 +104,7 @@ M: float number>text
         [ string>number number>text ]
         [ [ "negative " prepend ] when ] bi*
     ] [
-        [ CHAR: 0 - small-numbers ] { } map-as " " join
+        [ CHAR: 0 - small-numbers ] { } map-as join-words
     ] bi* " point " glue ;
 
 M: complex number>text
index 427c3d689b81c55d3907cd0a48639f6025638250..6227986dc7771073726f6a9f1c4c8a8414569ff8 100644 (file)
@@ -151,7 +151,7 @@ MEMO: glossary ( -- assoc )
             dup number?
             [ number>string ]
             [ glossary ?at drop ] if
-        ] map " " join
+        ] map join-words
     ] map "/" join ;
 
 : parse-timestamp ( str -- str' )
@@ -701,7 +701,7 @@ sky-condition raw ;
     [ re-visibility matches? ] find-one
     [ parse-visibility pick visibility<< ] when*
 
-    [ re-rvr matches? ] find-all " " join
+    [ re-rvr matches? ] find-all join-words
     [ parse-rvr ] map ", " join pick rvr<<
 
     [ re-weather matches? ] find-all
@@ -727,7 +727,7 @@ sky-condition raw ;
     [ re-visibility matches? ] find-one
     [ parse-visibility pick visibility<< ] when*
 
-    [ re-rvr matches? ] find-all " " join
+    [ re-rvr matches? ] find-all join-words
     [ parse-rvr ] map ", " join pick rvr<<
 
     [ re-weather matches? ] find-all
index 38d46f2b50585e2b2fbd3eb720cf931af30d9d32..3bdf77ca284947d1ba4c8bd1fdbc9b4f81b705d3 100644 (file)
@@ -28,7 +28,7 @@ TUPLE: maze < astar ;
   6  X X X X   X   X e X
   7  X g   X           X
   8  X X X X X X X X X X"
-        "\n" split ] nth nth CHAR: X = not ;
+        split-lines ] nth nth CHAR: X = not ;
 
 M: maze neighbours
     drop
index 7c9817c2f64ebeb0de374d588ff8a1c6bf46afa2..84c70190ff4dc60f04cb322221e31779dc25f1e5 100644 (file)
@@ -44,7 +44,7 @@ Further,$allow$for$each$word$in$a$column$to$be$either$left$
 justified,$right$justified,$or$center$justified$within$its$column."
 
 : split-and-pad ( text -- lines )
-    "\n" split [ "$" split harvest ] map
+    split-lines [ "$" split harvest ] map
     dup longest length
     '[ _ "" pad-tail ] map ;
 
index 5ae0a01357de8e1d26d67b89583606db9c7b126e..917f3661c0045ac27172536fc9388ee91ccbfdbe 100644 (file)
@@ -2,9 +2,9 @@
 ! See http://factorcode.org/license.txt for BSD license
 
 USING: accessors assocs base64 calendar calendar.format
-checksums.hmac checksums.sha combinators combinators.smart
-formatting fry http http.client json.reader json.writer kernel
-locals make math.parser namespaces random sequences ;
+checksums.hmac checksums.sha combinators.smart formatting http
+http.client json.reader json.writer kernel make math.parser
+namespaces random sequences splitting ;
 
 IN: visionect
 
@@ -24,7 +24,7 @@ SYMBOL: visionect-api-secret
         [ "content-type" header ]
         [ "date" header ]
         [ url>> path>> ]
-    } cleave>array "\n" join
+    } cleave>array join-lines
     visionect-api-secret get sha-256 hmac-bytes >base64
     visionect-api-key get ":" rot 3append ;