Handbook
Glossary
with-style ( style quot -- )
Factor handbook
»
Input and output
»
Formatted output
»
Formatted output on the default stream
Prev:
format ( str style -- )
Next:
with-nesting ( style quot -- )
Vocabulary
io
.
styles
Inputs
style
an
assoc
quot
a
quotation
Outputs
None
Word description
Calls the quotation in a new dynamic scope where calls to
write
,
format
and other stream output words automatically inherit style settings from
style
.
Notes
Details are in the documentation for
make-span-stream
.
Errors
Throws an error if the I/O operation fails.
Definition
USING:
assocs
io
kernel
namespaces
;
IN:
io.styles
:
with-style
( style quot -- )
swap
dup
assoc-empty?
[
drop
call
]
[
output-stream
get
make-span-stream
swap
with-output-stream
]
if
;
inline