prettyprint: @mrjbq7's funny word for . that doesn't limit the length of things.

db4
Doug Coleman 2014-10-09 18:50:38 -07:00
parent 659572f30a
commit 38e0b0643f
2 changed files with 13 additions and 1 deletions

View File

@ -159,9 +159,10 @@ ARTICLE: "prettyprint" "The prettyprinter"
$nl
"Prettyprinter words are found in the " { $vocab-link "prettyprint" } " vocabulary."
$nl
"The key words to print an object to " { $link output-stream } "; the first two emit a trailing newline, the second two do not:"
"The key words to print an object to " { $link output-stream } "; the first three emit a trailing newline, the second three do not:"
{ $subsections
.
...
short.
pprint
pprint-short
@ -205,6 +206,15 @@ HELP: .
"Printing a large object can take a long time and consume a lot of memory. If you need to print large objects, use " { $link short. } " or set some " { $link "prettyprint-variables" } " to limit output size."
} ;
HELP: ...
{ $values { "obj" object } }
{ $description "Prettyprints an object to " { $link output-stream } " with a trailing line break. Output is unlimited in length." }
{ $warning
"Printing a large object can take a long time and consume a lot of memory. If you need to print large objects, use " { $link short. } " or set some " { $link "prettyprint-variables" } " to limit output size."
} ;
{ . ... } related-words
HELP: unparse
{ $values { "obj" object } { "str" "Factor source string" } }
{ $description "Outputs a prettyprinted string representation of an object. Output is influenced by many variables; see " { $link "prettyprint-variables" } "." }

View File

@ -21,6 +21,8 @@ IN: prettyprint
: . ( obj -- ) pprint nl ;
: ... ( obj -- ) [ . ] without-limits ;
: pprint-use ( obj -- ) [ pprint* ] with-use ;
: unparse ( obj -- str ) [ pprint ] with-string-writer ;