]> gitweb.factorcode.org Git - factor.git/blob - basis/io/streams/string/string-docs.factor
merge project-euler.factor
[factor.git] / basis / io / streams / string / string-docs.factor
1 USING: help.markup help.syntax io strings quotations sequences ;
2 IN: io.streams.string
3
4 ARTICLE: "io.streams.string" "String streams"
5 "String streams:"
6 { $subsections
7     <string-reader>
8     <string-writer>
9 }
10 "Utility combinators:"
11 { $subsections
12     with-string-reader
13     with-string-writer
14 } ;
15
16 ABOUT: "io.streams.string"
17
18 HELP: <string-writer>
19 { $values { "stream" "an output stream" } }
20 { $description "Creates an output stream that collects text into a string buffer. The contents of the buffer can be obtained by executing " { $link >string } "." } ;
21
22 HELP: with-string-writer
23 { $values { "quot" quotation } { "str" string } }
24 { $description "Calls the quotation in a new dynamic scope with " { $link output-stream } " rebound to a new string writer. The accumulated string is output when the quotation returns." } ;
25
26 HELP: <string-reader>
27 { $values { "str" string } { "stream" "an input stream" } }
28 { $description "Creates a new stream for reading " { $snippet "str" } " from beginning to end." }
29 { $notes "The implementation exploits the ability of string buffers to respond to the input stream protocol by reading characters from the end of the buffer." } ;
30
31 HELP: with-string-reader
32 { $values { "str" string } { "quot" quotation } }
33 { $description "Calls the quotation in a new dynamic scope with " { $link input-stream } " rebound to an input stream reading " { $snippet "str" } " from beginning to end." } ;