io Module

ask

str1 str2

Prints str1 (prompt), reads a line from STDIN and places it on top of the stack as a string.

choose

((str1 quot1)+) str2 a*

Prints str2, then prints all str1 included in the quotation prepended with a number, and waits from valid input from the user.

If the user enters a number that matches one of the choices, then the corresponding quotation quot1 is executed, otherwise the choice menu is displayed again until a valid choice is made.

clear

Clears the screen.

color

bool

Enables or disabled color output in terminal (enabled by default).

column-print

quot int a

Prints all elements of quot to STDOUT, in int columns.

confirm

str bool

Prints str (prompt) appending " [yes/no]: ", reads a line from STDIN and:

  • if it matches /^y(es)?$/i, puts true on the stack.
  • if it matches /^no?$/i, puts false on the stack.
  • Otherwise, it prints Invalid answer. Please enter 'yes' or 'no': and waits for a new answer.

debug

a a

Prints a and a new line to STDOUT, if logging level is set to debug or lower.

error

a a

Prints a and a new line to STDERR, if logging level is set to error or lower.

fatal

a a

Prints a and a new line to STDERR, and exists the program with error code 100.

getchr

int

Reads single character from STDIN without waiting for ENTER key and places its ASCII code on top of the stack.

info

a a

Prints a and a new line to STDOUT, if logging level is set to info or lower.

mapkey

quot 'sym

Maps the named key/key combination 'sym to the quotation quot, so that quot is executed when key 'sym is pressed.

Notes

  • At present, only the key names and sequences defined in the minline library are supported.
  • The quotation will be executed by a copy of the min interpreter created when the mapping was defined. In other words, quotations executed by key bindings will not affect the current stack.

notice

a a

Prints a and a new line to STDOUT, if logging level is set to notice (default) or lower.

password

str

Reads a line from STDIN displaying * for each typed character, and places it on top of the stack as a string.

putchr

str a

Prints str to STDOUT without printing a new line (str must contain only one character).

unmapkey

'sym

Unmaps a previously-mapped key or key-combination 'sym, restoring the default mapping if available.

Notes

  • At present, only the key names and sequences defined in the minline library are supported.
  • At present, all the default mappings of min are those provided by the minline library.

warn

a a

Prints a and a new line to STDERR, if logging level is set to warn or lower.