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.

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.

fappend

str1 str2

Appends str1 to the end of file str2.

fatal

a a

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

fread

str str

Reads the file str and puts its contents on the top of the stack as a string.

fwrite

str1 str2

Writes str1 to the file str2, erasing all its contents first.

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.

newline

Prints a new line to STDOUT.

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.

print

a a

Prints a to STDOUT.

putchr

str a

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

read

read fread

See fread.

type

a str

Puts the data type of a on the stack. In cased of typed dictionaries, the type name is prefixed by dict:, e.g. dict:module, dict:socket, etc.

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.

write

write fwrite

See fwrite.