3.48. kink/io/STR_PRINTER

Provides str printers.

3.48.1. STR_PRINTER.new_pair(New_line)

STR_PRINTER.new_pair Makes a printer which builds a str, with the New_line.

Precondition:

• New_line must be a str

STR_PRINTER.new_pair returns a pair of [Printer $gen_str], where the Printer is a printer which builds a str, and $gen_str is a thunk which returns the built str.

Example:

:STR_PRINTER.require_from('kink/io/')

[:P :gen_str] <- STR_PRINTER.new_pair("\r\n")
P.print_line('foo')
P.print_line('bar')
stdout.print_line(gen_str.repr) # => "foo\r\nbar\r\n"