X : Quick Reference


Abbreviations:

     bool  : boolean value, 0|1, or list of boolean values
     comm  : command: instruction or procedure
     comp  : comparator function
     def   : routine definition (func or proc)
     exp   : expression: literal, or variable or function call
     func  : function
     iexp  : integer expression
     int   : integer
     list  : list only, not just a number
     obj   : object, list or number
     oper  : operator
     proc  : procedure
     real  : real number
     rid   : routine id
     stri  : string, 1-d char list
     struc : structural element
     sym   : yet unspecified symbol, name of routine or variable
     tab   : table, associative array
     var   : variable
system : built-in symbols
symbol kind input output see also note
!= operator exp exp bool equal compare 'not same as' relational operator
# comment: extends from '#' sign to end of line
& oper exp exp list append push concatenation list operator
* oper exp exp obj + - / mod ** multiplication operator
** oper exp exp obj + - / mod * power operator
+ oper exp exp obj ** - / mod * addition operator
++ oper ref =+ =- increment a variable by 1
, comm comma: repeat last command
- oper exp exp obj ** + / mod * subtraction operator
-- oper ref =+ =- decrement variable by 1
. separ end separates namespace label from var or routine name
.. oper exp exp end 'slice' operator, only inside square brackets
/ oper exp exp obj * - * mod * division operator
; struc : definition & control structure terminator
< oper exp exp bool != <= == > >= 'less than' relational operator
<= oper exp exp bool != < == > >= 'less than or equal' relational operator
= comm var exp Assignment, uknown variable is created
=& oper var exp Concatenation shortcut assignment
=* oper var exp Multiplication shortcut assignment
=+ oper var exp Addition shortcut assignment
symbol kind input output see also note
=- oper var exp Subtraction shortcut assignment
=/ oper var exp Division shortcut assignment
== oper var exp 'The same' relational operator
> oper exp exp bool != < <= == >= 'greater than' relational operator
>= oper exp exp bool != < <= == > 'greater than or equal' relational operator
? proc exp put say
and oper exp exp bool or xor logical operator
append func list exp list prepend push returned list is the extended original list with the expression as its last element
atom func exp bool integer list return true (1) if exp is an atom, otherwise false (0)
band oper exp exp int bor bxor 'bitwise' logical operator
bnot oper exp exp bor 'bitwise' unary logical operator
bor oper exp exp int band bxor 'bitwise' logical operator
bxor oper exp exp int band bor 'bitwise' logical operator
call proc address call a machine language routine with starting address
call_func func rid args call_proc rid call user-defined function
call_proc proc rid args call_func rid call user-defined function
clear_screen proc works both in text and graphics modes
clone func obj count list list constructor: object is repeated count times
close proc int open close file or device and flush buffer
comm_line func list get_env return a list of strings reflecting command line that started program
symbol kind input output see also note
compare func obj1 obj2 -1|0|1 == eq return 0 if objects are identical, -1 if obj1 is smaller, +1 if it is bigger
date func list time return a list: {year month day hour minute second weekday day_number}
else struc control structure element
elsif struc control structure element
end func exp exp .. shorthand for list length at indicated index level, only inside square brackets
eq comp exp exp bool == compare object comparator
exit struc for step while loop causes immediate exit from for, step, loop & while structures
export comm name import marks variable or routine name for export
false var true system 'constant', 0
find func obj list int compare match return index of the first element of list that matches, or 0
floor func exp iexp mod round round down to an integer
for struc var from to step control structure element
form comm stri obj stri say format output string
symbol kind input output see also note
func def name args proc return function definition
get_key func int wait_key return pressed key without waiting
get_line func list getc get_key fetch the next line from 'in', including "`n at the end of line. -1 is returned when the end of file is reached
getc func int get_key get_line fetch the next byte from 'in'. -1 is returned at the end of file
global comm name private marks variable or routine name as global, with unrestricted scope
if struc bool first part of if-elsif-else control structure
import comm filename label export import filename, label as prefix in 'dot' notation
in var out system variable holding current intput handle
integer func exp bool atom list return true (1) if exp is an integer, otherwise false (0)
kbd const screen system constant, 0, standard input
length func list int end return length of list
list func exp bool integer atom return true (1) if exp is a list, otherwise false (0)
log func exp exp log10 'Napierian', base 'e' logarithm
loop struc while exit 'infinite' loop, must use 'exit'
mach_func func int obj mach_proc perform a machine specific function
mach_proc proc int obj mach_func perform a machine specific operation
match func list1 list2 int find match list1 against a slice od list2. return index of list2 where the first match begins, or 0 if match not found
mem_copy proc a1 a2 n mem_set copy n bytes of memory from address a2 to a1
mem_set proc a v n mem_copy set n bytes of memory starting at address a to a value v
mod oper exp exp obj / floor 'modulo' arithmetic operator
symbol kind input output see also note
not oper exp bool bnot unary logical operator
open func int int close open a file or device, -1 is returned when it fails
or oper exp exp bool and xor
out var in system variable holding current intput handle
peek func a|{a n} b|blist peek4s peek4upoke return a single byte or a byte list
peek4s func a|{a n} b|blist peek peek4upoke same as peek above, except the returned values are signed 32-bit integers
peek4u func a|{a n} b|blist peek peek4spoke same as peek above, except the returned values are 32-bit unsigned integers
pixel proc a|{a n} b|blist peek peek4spoke same as peek above, except the returned values are 32-bit unsigned integers
platform func int get_pos return: dos32=1, win32=2, linux=3
poke proc a i|list peek poke4 write a single byte or a list of byte starting at address a
poke proc a i|list peek4s peek4u poke write one 4-byte value or a list of them starting at address a
pos proc row col get_pos
private proc name global marks variable inside a routine as private to the routine
prepend func list exp list append returned list is the extended original list with the expression as its first element
symbol kind input output see also note
proc def name args func procedure definition
push proc *list obj append shortcut: 'push s x' is same as '= s append s x'
put proc obj ? out say write obj to device or file specified in 'out'
rand func x1 x2 set_rand generate random int in range from 1 to x
return comm exp func causes immediate return from a function
rid func string int call_func call_proc return routine id, or -1 when routine not found
say proc string ? out put write string to device or file specified in 'out'
screen const kbd system 'constant', file handle, 1
sqrt func exp obj ** return square root
step struc var from to by for for loop with specified step
swap proc *obj *obj swaps values of two referenced variables
time func sex tick_rate return number of seconds since midnight
true const false system 'constant', 1
while struc bool loop exit control structure, can use 'exit'
xor oper bool bool bool and or logical operator

graph : graphics module
symbol kind input output see also note
background proc color_index text_color set background color
bar proc c f x y w h polygon box draw filled rectangle if f=1, hollow if f=0
cursor proc int select cursor style: no_cursor $2000, underline_cursor $0607, thick_underline_cursor $0507, half_block_cursoer $0407, block_cursor $0007
draw_line proc int xylist polygon draw line connecting xylist points
ellipse proc c f x y w h bar draw hollow ellipse if f=0, filled if f=1
get_palette func color {r g b} palette palettes return rgb of chosen color.
get_pos func {r c} pos return row and column cursor position
gmode func mode int set graphics mode. return error number, or 0 when successful
palette proc c {r g b} get_palette palettes set new color mix for given color index
palettes proc c rgb_list palette set new color mix for a list of consecutive colors, starting with color index c
polygon proc c xylist draw_line draw filled polygon of color c with xylist vertices
scroll proc n top bot scroll text between top and bottom line by n lines
text_color proc int background set foreground text color
text_rows func n1 n2 attempt to set the number of lines on a text screen; n2 is the actual number
vcfg func list gmode returns video configuration: {color? mode lines columns xpix ypix #colors pages}
wrap proc bool wrap (true)or truncate (false) long lines

mach : machine interface module
symbol kind input output see also note
alloc func iexp address alloc_low free allocate n contiguous bytes of memory. Return starting address, or 0 if the memory can't be allocated
alloc_low func n address alloc free_low allocate n contiguous bytes of memory. Return starting address, or 0 if the memory can't be allocated
a_to_f32 func atom list a_to_f64 f32_to_a convert an atom to a list of 4 single-byte values
a_to_f64 func atom list a_to_f32 f64_to_atom convert an atom to a list of 8 single-byte values
bits_to_int func list int int_to_bits convert a list of binary 0's and 1's into a positive number
bytes_to_int func list int int_to_bytes convert a 4-element list of binary bytes to an atom
f32_to_a func list atom a_to_f32 f32_to_a convert a list of 4 single-byte values to an atom
f64_to_a func list atom a_to_f64 f32_to_a convert a list of 8 single-byte values to an atom
free proc address alloc free_low free up previously allocated block of memory
free_low proc address alloc_low free free up previously allocated block of low memory
input func port byte output read a byte from an I/O port
int_to_bits func atom n list bits_to_int return low-order n bits of atom as a list of 0's and 1's
int_to_bytes func int list bytes_to_int return an integer as a list of 4 bytes, least-significant byte first
output proc byte port input write a byte to an I/O port
sound proc freq turn speaker on at given frequency; turn it off if freq is 0
tick_rate proc rate time specify the number of tick interrupts per second

math : mathematics module
symbol kind input output see also note
abs func exp exp sign returns absolute value of an expresion
acos func exp real atan asin arccosine, returns angle in degrees
asin func exp real acos atan arcsine, returns angle in degrees
atan func exp real acos asin arctan, returns angle in degrees
cos func exp exp cos tan cosine function, argument in degrees
d2r const r2d 'degrees-to-radians' conversion factor: pi/180
e const exp system 'constant', e = 2.71828...
exp func exp exp ** e exponential function
fact func int int factorial function
log10 func exp exp log 'Briggsian", base 10 logarithm
pi const e system 'constant', pi = 3.14159...
r2d const d2r conversion factor: 180/pi
round func exp iexp floor round to the nearest integer, .5 rounds up
set_rand proc int rand seed random number generator
sign func exp exp abs sign func, returns -1, 0 or 1 for each number
sin func exp exp cos tan sine function, argument in degrees
tan func exp exp cos tan tan function, argument in degrees

tables : associative arrays
symbol kind input output see also note
fetch func tab key obj store set fetch table value corresponding to given key
index func tab key int store fetch return table index of specified key
set proc *tab key val store fetch replace existing value
store proc *tab key val fetch set store value under given key. If key does not exist, it is generated.

This website maintained and coded by jiri babor