On this page:
print
println
show
showln
Print  Mode
Print  Mode.text
Print  Mode.expr
8.15.0.12

13.6 Printing🔗ℹ

function

fun print(v :: Any, ...,

          ~out: out :: Port.Output = stdout,

          ~mode: mode :: PrintMode = #'text,

          ~pretty: pretty = Printable.current_pretty())

  :: Void

Prints each v to out. In the case that more than one v is provided, a space is printed between the output for each vunless pretty is #true, in which case a newline is printed between the output of each v.

In #'text mode, strings, symbols, identifiers, and keywords print as their character content, a byte string prints as its raw byte content, and a syntax object prints as unquoted. Any other predefined kind of value prints the same in #'text and #'expr mode, but a class can implement Printable so that its instances print differently in different modes.

When pretty is #true, then compound values like lists may print with line breaks to split the output across lines. When pretty is #false, then printing tends to use a single line, but also prints faster. The value of the Printable.current_pretty context parameter is to match pretty while printing, which affects functions like PrintDesc.list.

> print("apple")

apple

> print("apple", ~mode: #'expr)

"apple"

> print("apple", "banana", "coconut")

apple banana coconut

> print("apple", "banana", "coconut", ~pretty: #true)

apple

banana

coconut

function

fun println(v :: Any, ...,

            ~out: out :: Port.Output = stdout,

            ~mode: mode :: PrintMode = #'text,

            ~pretty: pretty = Printable.current_pretty())

  :: Void

Prints like print, then prints a newline.

function

fun show(v :: Any, ...,

         ~out: out :: Port.Output = stdout,

         ~pretty: pretty = Printable.current_pretty())

  :: Void

 

function

fun showln(v :: Any, ...,

           ~out: out :: Port.Output = stdout,

           ~pretty: pretty = Printable.current_pretty())

  :: Void

Like print and println with ~mode: #'expr.

enumeration

enum PrintMode:

  text

  expr

A printing mode for use with functions like print.