-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
" T{ #call { word * } { in-d V{ \"x\" 1 } } { out-d { 2 } } }"
" T{ #copy { in-d V{ 2 } } { out-d { \"y\" } } }"
"}"
- } "\n" join
+ } join-lines
]
}
} ;
: (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) ;
} 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 [
! 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 )
] if ;
: modifiers ( spec -- string )
- modifiers>> [ lookup-modifier ] map " " join
+ modifiers>> [ lookup-modifier ] map join-words
[ "" ] [ " " prepend ] if-empty ;
HOOK: bind% db-connection ( spec -- )
first delimiter split1 :> ( before after )
before accum push
after [
- accum "\n" join
+ accum join-lines
rest after prefix
] [
rest delimiter accum (take-until)
[
'[
_ rest [
- but-last "\n" join
+ but-last join-lines
eval-with-stack
"\n" ?tail drop
] keep
-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
"ARTICLE: { \"test\" 1 } \"Hello\""
"\"abc\""
"\"def\" ;"
- } "\n" join
+ } join-lines
[
"testfile" path>source-file current-source-file set
eval( -- )
[ 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
[ read-response ] with-string-reader
[ write-response ] with-string-writer
! normalize crlf
- split-lines "\n" join
+ split-lines join-lines
] unit-test
{ t } [
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?
! 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"
" }"
" }"
"}"
- } "\n" join
+ } join-lines
]
}
} ;
[ 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 ;
""
}
} [
- [ \ method-layout see-methods ] with-string-writer "\n" split
+ [ \ method-layout see-methods ] with-string-writer split-lines
] unit-test
: soft-break-test ( -- str )
""
}
} [
- [ \ class-see-layout see ] with-string-writer "\n" split
+ [ \ class-see-layout see ] with-string-writer split-lines
] unit-test
{
""
}
} [
- [ \ 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
""
}
} [
- [ \ 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 } ;
""
}
} [
- [ \ 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 } ;
""
}
} [
- [ \ 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 } ;
""
}
} [
- [ \ 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
""
}
} [
- [ \ 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
: 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 )
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 ;
[ "()" member? ] trim
"[" "]" surround
] [
- nip "\0" split harvest " " join
+ nip "\0" split harvest join-words
] if-empty ;
: safe-ps-cmdline ( path -- string/f )
<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 ]
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 ;
-USING: help.markup help.syntax literals sequences strings ;
+USING: help.markup help.syntax literals sequences splitting
+strings ;
IN: vocabs.files
HELP: vocab-tests-path
" \"resource:basis/alien/libraries/libraries-docs.factor\""
" \"resource:basis/alien/libraries/libraries-tests.factor\""
"}"
- } "\n" join
+ } join-lines
]
}
} ;
" \"resource:basis/xml/tests/xmltest.factor\""
" \"resource:basis/xml/tests/xmode-dtd.factor\""
"}"
- } "\n" join
+ } join-lines
]
}
} ;
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
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
] [
[
receive-socket>> receive
- [ utf8 decode "\n" split parse-lines ] dip
+ [ utf8 decode split-lines parse-lines ] dip
] keep handle-data t
] if
] loop
[ 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 ;
] [ nip ] if ":" join ;
: replace-log-line-numbers ( object log -- log' )
- "\n" split harvest
+ split-lines harvest
[ replace-log-line-number ] with map
join-lines ;
] [
nip output>>
"Use one of: " split1 nip "\n" ?tail drop
- " " split
+ split-words
] recover ;
! http://www.graphviz.org/Download_macos.php#comment-474
[ 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
dup number?
[ number>string ]
[ glossary ?at drop ] if
- ] map " " join
+ ] map join-words
] map "/" join ;
: parse-timestamp ( str -- str' )
[ 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
[ 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
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
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 ;
! 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
[ "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 ;