TUFPL Library Documentation

Version 0.8.24-2-gfd26e7a generated 2022-10-01 09:21

Modules

TUFPL_rts.c
TUFPL_strings.c
TUFPL_inout.c
TUFPL_math.c
TUFPL_chunk.c
TUFPL_tuflib.tuf
TUFPL_crypto.c
TUFPL_hashmap.tuf
TUFPL_matrix.tuf

Literals

TUFPL_tuflib.tuf

#MaxInt31 =               2'147'483'647
#MaxInt32 =               4'294'967'295
#MaxInt63 =   9'223'372'036'854'775'807
#MaxInt64 =  18'446'744'073'709'551'615
#Pi = 3.141'592'653'589'793'238'46
#E =  2.718'281'828'459'045'235'36
#Whitespace = ' &tab;&nl;&cr;'
#ASCIIupperLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
#ASCIIlowerLetters = 'abcdefghijklmnopqrstuvwxyz'
#ASCIIletters =  'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
#DecimalDigits = '0123456789'
#HexDigits = '01234567890abcdefABCDEF'

Index

as c integer (str)  [STRINGS]
as float (str)  [STRINGS]
as integer (str)  [TUFLIB]
as integer (str) else (default)  [TUFLIB]
as map string pairs (str)  [TUFLIB]
as map tuple pairs (tup)  [TUFLIB]
as string (num)  [STRINGS]
new basic pipe  [INOUT]
basic pipe (pd) close reading  [INOUT]
basic pipe (pd) close writing  [INOUT]
basic pipe (pd) get  [INOUT]
basic pipe (pd) put (str)  [INOUT]
bit (n) is set in (x)  [RTS]
boolean (b) as string  [STRINGS]
bunch (bunch) get fields  [RTS]
bunch (bunch) lock  [RTS]
bunch (bunch) set fields (map)  [RTS]
bunch (bunch) unlock  [RTS]
call (func) with (parm)  [RTS]
call (func) with (parm1) and (parm2)  [RTS]
call (func) with (parm1) and (parm2) and (parm3)  [RTS]
cformat (format) number(num)  [STRINGS]
cformat (format) (num)  [STRINGS]
new chunk size (size)  [CHUNK]
chunk (tgt) at (toffset) size (tsize) put chunk (src) at (soffset) size (ssize)  [CHUNK]
chunk (ck) get integer at (offset) size (size)  [CHUNK]
chunk (ck) get string at (offset) size (size)  [CHUNK]
chunk (bcr) get string at (offset) size (size) until linefeed  [CHUNK]
chunk (bcr) get string at (offset) size (size) until zero  [CHUNK]
chunk (bcr) get string at (offset) size (size) until (stop)  [CHUNK]
chunk (tgt) put integer (src) at (offset) size (size)  [CHUNK]
chunk (tgt) put string (str) at (offset) size (len)  [CHUNK]
chunk (chunk) set byteorder (char)  [RTS]
chunk (ck) slice at (offset) size (size)  [CHUNK]
chunk (dk) zero  [CHUNK]
chunk (ck) zero at (offset)  [CHUNK]
chunk (ck) zero at (offset) size (size)  [CHUNK]
new command stream reads (command)  [INOUT]
new command stream write (command)  [INOUT]
command stream (fd) close  [INOUT]
command stream (fd) get  [INOUT]
command stream (fd) put(string)  [INOUT]
command string (cmd) give lines  [TUFLIB]
command string (cmd) lines  [TUFLIB]
command (cmd) give lines  [TUFLIB]
command (cmd) lines  [TUFLIB]
count of (item)  [RTS]
debug disable  [RTS]
debug dump used items  [RTS]
debug dump (x)  [RTS]
debug enable  [RTS]
debug info (x)  [RTS]
debug is enabled  [RTS]
debug print calls (depth)  [STRINGS]
debug print here (mixed)  [STRINGS]
debug print lno (mixed)  [STRINGS]
debug print (mixed)  [STRINGS]
debug print (mixed) nonl  [STRINGS]
new directory stream reads (dirnam)  [INOUT]
directory stream (fd) close  [INOUT]
directory stream (fd) get  [INOUT]
directory (dirpath) create  [INOUT]
directory (dir) filenames  [TUFLIB]
directory (dir) give filenames  [TUFLIB]
error print (mixed)  [STRINGS]
error print (mixed) nonl  [STRINGS]
new fault code (code) message (msg)  [RTS]
new file chunk append (fn)  [INOUT]
new file chunk create (fn)  [INOUT]
new file chunk modify (fn)  [INOUT]
new file chunk read (fn)  [INOUT]
file chunk (fd) close  [INOUT]
file chunk (fd) position (loc) current  [INOUT]
file chunk (fd) position (loc) end  [INOUT]
file chunk (fd) position (loc) start  [INOUT]
file chunk (fd) read (ck) at (pos) size (size)  [INOUT]
file chunk (fd) tell position  [INOUT]
file chunk (fd) write (ck) at (pos) size (size)  [INOUT]
file standard input give lines  [TUFLIB]
new file stream appends (fn)  [INOUT]
new file stream filename (fn) mode (str)  [INOUT]
new file stream modifies (fn)  [INOUT]
new file stream reads (fn)  [INOUT]
new file stream replaces (fn)  [INOUT]
new file stream rewrites (fn)  [INOUT]
new file stream updates (fn)  [INOUT]
file stream (fd) append (line) atomically  [INOUT]
file stream (stream) close  [INOUT]
file stream (fd) flush  [INOUT]
file stream (fd) get  [INOUT]
file stream (stream) is tty  [INOUT]
file stream (fd) put (string)  [INOUT]
file stream (fd) seek (loc)  [INOUT]
file stream (fd) tell  [INOUT]
file (filename) attributes  [INOUT]
file (filename) extended attribute (attrname)  [INOUT]
file (filename) extended attribute (attrname) set (value)  [INOUT]
file (filename) give lines  [TUFLIB]
file (oldfn) hard link to (newfn)  [INOUT]
file (filename) lines  [TUFLIB]
file (filename) real pathname  [INOUT]
file (oldfn) symbolic link to (newfn)  [INOUT]
file (obsfn) unlink  [INOUT]
float (num) as string  [STRINGS]
from (first) downto (last)  [TUFLIB]
from (first) downto (last) step (step)  [TUFLIB]
from (first) to (last) step (step)  [TUFLIB]
from (first) upto (last)  [TUFLIB]
from (start) upto (last) give tuples  [TUFLIB]
from (first) upto (last) step (step)  [TUFLIB]
give keys (bunch)  [RTS]
give values (bunch)  [RTS]
group (str)  [TUFLIB]
group (str) by (gm)  [TUFLIB]
new hashmap  [HASHMAP]
new hashmap size (cnt) hash (hashfunc)  [HASHMAP]
new hashmap size (cnt)  [HASHMAP]
hashmap (this) at (key) get  [HASHMAP]
hashmap (this) at (key) put (val)  [HASHMAP]
hashmap (this) count  [HASHMAP]
hashmap (this) give key value pairs ascending  [HASHMAP]
hashmap (this) give keys  [HASHMAP]
hashmap (this) give keys ascending values  [HASHMAP]
hashmap (this) give keys descending values sync  [HASHMAP]
hashmap (this) give value key pairs ascending  [HASHMAP]
hashmap (this) give values  [HASHMAP]
hashmap (this) key value pairs as row  [HASHMAP]
hashmap (this) keys as row  [HASHMAP]
hashmap (this) statistics  [HASHMAP]
hashmap (this) value key pairs as row  [HASHMAP]
integer (i) as string base (basespec)  [TUFLIB]
integer (i) code point as string  [STRINGS]
is (x) boolean  [RTS]
is (x) chunk  [RTS]
is (x) fault  [RTS]
is (x) float  [RTS]
is (x) function  [RTS]
is (x) hashmap  [HASHMAP]
is (key) in (set)  [TUFLIB]
is (x) integer  [RTS]
is (x) map  [RTS]
is (x) matrix  [MATRIX]
is (key) not in (set)  [TUFLIB]
is (x) number  [RTS]
is (x) odd  [RTS]
is (x) rational  [RTS]
is (x) row  [RTS]
is (n) square  [TUFLIB]
is (x) string  [RTS]
is (x) tuple  [RTS]
is (x) void  [RTS]
join (rmt)  [TUFLIB]
join (rmt) by (sep)  [TUFLIB]
new map  [RTS]
map (this) add pairs (rmt)  [TUFLIB]
map (this) as string key (delim) value by (sep) quote (qr)  [TUFLIB]
map (this) copy  [TUFLIB]
map (this) copy lean  [TUFLIB]
map (this) give key value pairs  [RTS]
map (this) give keys  [RTS]
map (this) give keys ascending  [TUFLIB]
map (this) give keys ascending values  [TUFLIB]
map (this) give keys descending  [TUFLIB]
map (this) give keys descending values  [TUFLIB]
map (this) give keys using (func)  [TUFLIB]
map (this) give values  [RTS]
map (this) join values by (sep)  [TUFLIB]
map (this) key value pairs as row  [TUFLIB]
map (this) key (key) add (value) unchecked  [RTS]
map (this) keys  [RTS]
map (this) keys as row  [RTS]
map (this) keys not unique  [TUFLIB]
new map (tagname)  [TUFLIB]
map (this) value key pairs as row  [TUFLIB]
map (this) values  [RTS]
map (this) values as row  [RTS]
math abs (item)  [RTS]
math arc cos (arg)  [MATH]
math arc sin (arg)  [MATH]
math arc tan (arg)  [MATH]
math arc tan (y) by (x)  [MATH]
math base (base) exp (exponent)  [MATH]
math base (base) exp (exponent) by square and multiply  [TUFLIB]
math base (base) log (arg)  [MATH]
math ceil (an)  [RTS]
math cos (arg)  [MATH]
math exp (arg)  [MATH]
math float (x)  [RTS]
math floor (an)  [RTS]
math gcd (tup)  [TUFLIB]
math int sqrt (n)  [MATH]
math int (arg) count digits (base)  [MATH]
math int (e) root (n)  [TUFLIB]
math lg (arg)  [MATH]
math log (arg)  [MATH]
math round (an)  [RTS]
math sign (item)  [RTS]
math sin (arg)  [MATH]
math sqrt (arg)  [MATH]
math tan (arg)  [MATH]
math trunc (an)  [RTS]
new matrix size (dimensions)  [MATRIX]
new matrix size (dimensions) origin (origin)  [MATRIX]
matrix (m) give keys  [MATRIX]
matrix (m) print  [MATRIX]
max of (vals)  [TUFLIB]
maximum of (vals)  [TUFLIB]
min of (vals)  [TUFLIB]
minimum of (vals)  [TUFLIB]
number (num) as string  [STRINGS]
pad left (mixed) to (len)  [TUFLIB]
pad left (mixed) to (len) by (chr)  [TUFLIB]
pad left (len) (str)  [TUFLIB]
pad right (mixed) to (len)  [TUFLIB]
pad right (mixed) to (len) by (chr)  [TUFLIB]
pad right (len) (str)  [TUFLIB]
print (mixed)  [STRINGS]
print (mixed) nonl  [STRINGS]
quote (string)  [TUFLIB]
random next float  [TUFLIB]
random next integer  [RTS]
random next integer noisy  [CRYPTO]
random set seed (seed)  [RTS]
new row  [RTS]
new row size (cells)  [RTS]
row (row) append (rmt)  [TUFLIB]
row (row) as map  [TUFLIB]
row (row) as tuple  [RTS]
row (src) clone  [TUFLIB]
row (src) copy  [TUFLIB]
row (row) dedup  [TUFLIB]
row (row) from (from) upto (upto)  [TUFLIB]
row (row) give keys  [RTS]
row (row) give values  [RTS]
row (row) join keys by (sep)  [TUFLIB]
row (row) join values as string  [TUFLIB]
row (row) join values by (sep)  [TUFLIB]
row (row) keys  [TUFLIB]
new row (tagname)  [TUFLIB]
row (args) parse options values (valopts)  [TUFLIB]
row (row) pop  [TUFLIB]
row (row) push (val)  [TUFLIB]
row (row) shrink  [TUFLIB]
new row (tagname) size (sz)  [TUFLIB]
row (row) sort ascending  [RTS]
row (row) sort descending  [RTS]
row (row) sort fast ascending  [RTS]
row (row) sort fast descending  [RTS]
row (row) sort fast using (func)  [RTS]
row (row) sort sync (val) ascending  [RTS]
row (row) sort sync (val) descending  [RTS]
row (row) sort sync (val) using (func)  [RTS]
row (row) sort using (func)  [RTS]
row (row) values  [TUFLIB]
sort (row) ascending  [RTS]
sort (row) descending  [RTS]
sort (row) fast ascending  [RTS]
sort (row) fast descending  [RTS]
sort (row) fast using (func)  [RTS]
sort (row) sync (val) ascending  [RTS]
sort (row) sync (val) descending  [RTS]
sort (row) sync (val) using (func)  [RTS]
sort (row) using (func)  [RTS]
string (string) as MD5 chunk  [CRYPTO]
string (string) as MD5 compact  [CRYPTO]
string (string) as MD5 hex  [CRYPTO]
string (string) as SHA1 chunk  [CRYPTO]
string (string) as SHA1 compact  [CRYPTO]
string (string) as SHA1 hex  [CRYPTO]
string (str) as character row  [TUFLIB]
string (str) as float  [STRINGS]
string (str) as float else (default)  [TUFLIB]
string (str) as integer  [TUFLIB]
string (str) as integer base (basespec)  [TUFLIB]
string (str) as integer clib (base)  [STRINGS]
string (str) as integer decimal  [TUFLIB]
string (str) as integer else (default)  [TUFLIB]
string (str) as map by pairs  [TUFLIB]
string (str) case flipped  [TUFLIB]
string (str) check ascii  [STRINGS]
string (str) code point at (pos)  [STRINGS]
string (str) count from (start) many of (accept)  [TUFLIB]
string (str) count from (start) none of (reject)  [TUFLIB]
string (str) decode percent encoding  [STRINGS]
string (str) encode numeric entities  [TUFLIB]
string (key) encrypt salt (salt)  [CRYPTO]
string (src) from (first)  [STRINGS]
string (str) from (pos) has (what)  [TUFLIB]
string (src) from (first) length (len)  [STRINGS]
string (str) from (start) many of (accept)  [TUFLIB]
string (src) from (start) none of (reject)  [TUFLIB]
string (src) from (first) upto (last)  [STRINGS]
string (str) give clips by any of (seps)  [TUFLIB]
string (str) give clips by many of (seps)  [TUFLIB]
string (src) give clips by (seps)  [TUFLIB]
string (str) group (gm)  [TUFLIB]
string (str) has character (c)  [TUFLIB]
string (str) has head (head)  [TUFLIB]
string (str) has tail (tail)  [TUFLIB]
string (str) hash  [STRINGS]
string (str) in lower case  [STRINGS]
string (str) in upper case  [STRINGS]
string (str) is ascii  [RTS]
string (str) is raw  [RTS]
string (str) locate (needle)  [STRINGS]
string (str) locate (needle) from (start)  [STRINGS]
string (string) matches filename (pattern)  [INOUT]
string (str) pad left to (len) by (chr)  [TUFLIB]
string (str) pad right to (len) by (chr)  [TUFLIB]
string (str) parse query  [TUFLIB]
string (str) quote for shell  [TUFLIB]
string (str) quoted  [TUFLIB]
string (str) replace at (pos) by (repl)  [TUFLIB]
string (str) replace character at (pos) by (repl)  [TUFLIB]
string (str) replace each (cue) by (repl)  [TUFLIB]
string (str) replace first (cue) by (repl)  [TUFLIB]
string (str) replace from (from) upto (upto) by (repl)  [TUFLIB]
string (str) replace many (pairs)  [TUFLIB]
string (str) split by any of (seps)  [TUFLIB]
string (str) split by many of (seps)  [TUFLIB]
string (str) split by (seps)  [TUFLIB]
string (str) starts lower case  [STRINGS]
string (str) starts upper case  [STRINGS]
string (str) times (ni)  [STRINGS]
string (src) upto (last)  [STRINGS]
string (str) without head (head)  [TUFLIB]
string (str) without leading whitespace  [TUFLIB]
string (str) without leading (chars)  [TUFLIB]
string (str) without trailing whitespace  [TUFLIB]
string (str) without trailing (chars)  [TUFLIB]
string (str) wrap (wrap)  [TUFLIB]
system call exit functions  [TUFLIB]
system cpu seconds  [RTS]
system cpu times  [RTS]
system current directory  [INOUT]
system epoch seconds  [RTS]
system exit (retcode)  [RTS]
system get environment  [RTS]
system get environment (key)  [TUFLIB]
system get locale  [RTS]
system get locale numeric  [RTS]
system info disable  [RTS]
system info enable  [RTS]
system on exit call (funcref) using (parm)  [TUFLIB]
system process fork  [RTS]
system process kill (pn)  [RTS]
system process kill (pn) with (signo)  [RTS]
system process own id  [RTS]
system process wait  [RTS]
system set groupsep (dg)  [RTS]
system set locale  [RTS]
system set locale (cat) to (val)  [RTS]
system set string localization map (ary)  [STRINGS]
system sleep (seconds)  [RTS]
system standard error  [INOUT]
system standard input  [INOUT]
system standard output  [INOUT]
time (seconds) format (fmt)  [RTS]
time (seconds) unpack as map  [RTS]
time (seconds) unpack local as map  [RTS]
new tuple size (count) values (vals)  [RTS]
tuple (tup) as map by pairs  [TUFLIB]
tuple (t) as row  [TUFLIB]
tuple (tup) from (from) upto (upto)  [TUFLIB]
tuple (tuple) give keys  [RTS]
tuple (tuple) give values  [RTS]
until negative (val)  [TUFLIB]
until void (val)  [TUFLIB]
until zero (val)  [TUFLIB]
while positive (val)  [TUFLIB]

Deprecated

abs (item)  [RTS]
apply runtime options (parm)  [TUFLIB]
as integer (str) clib (base)  [STRINGS]
as map row (row)  [TUFLIB]
attributes of file (filename)  [INOUT]
bytes of (item)  [RTS]
call function (func) using (parm)  [RTS]
call function (func) using (parm1) and (parm2)  [RTS]
call function (func) using (parm1) and (parm2) and (parm3)  [RTS]
call (func) using (parm)  [RTS]
call (func) using (parm1) and (parm2)  [RTS]
call (func) using (parm1) and (parm2) and (parm3)  [RTS]
ceil (an)  [RTS]
clip (src) from (first)  [STRINGS]
clip (src) from (first) length (len)  [STRINGS]
clip (src) from (first) upto (last)  [STRINGS]
clip (src) upto (last)  [STRINGS]
clip (str) without leading whitespace  [TUFLIB]
clip (str) without leading (chars)  [TUFLIB]
clip (str) without trailing whitespace  [TUFLIB]
clip (str) without trailing (chars)  [TUFLIB]
command (cmd) row of lines  [TUFLIB]
count (item)  [RTS]
debug print stack (depth)  [STRINGS]
encrypt password (key) with salt (salt)  [CRYPTO]
new fault item with code (code) and message (msg)  [RTS]
fault (fault) is checked  [RTS]
fault (item) mark checked  [RTS]
file (filename) get attributes  [INOUT]
file (filename) row of lines  [TUFLIB]
first key (row)  [RTS]
float from (str)  [STRINGS]
float (x)  [RTS]
floor (an)  [RTS]
format number using (format) for (num)  [STRINGS]
format (num) using (format)  [STRINGS]
get environment value of (key)  [TUFLIB]
give filenames of directory (dir)  [TUFLIB]
give indices of map (map)  [RTS]
give indices of row (row)  [RTS]
give lines from file (filename)  [TUFLIB]
give lines from standard input  [TUFLIB]
give lines of command (cmd)  [TUFLIB]
give (bunch) indices  [RTS]
give (bunch) keys  [RTS]
give (bunch) values  [RTS]
integer from string (str)  [TUFLIB]
integer from string (str) else (default)  [TUFLIB]
integer from (str)  [TUFLIB]
integer from (str) base (base)  [STRINGS]
integer from (str) else (default)  [TUFLIB]
integer (an)  [RTS]
is character (c) in string (str)  [TUFLIB]
is input a tty  [INOUT]
is output a tty  [INOUT]
is string (str) ascii  [RTS]
has string (str) character (c)  [TUFLIB]
is string (tail) ending (str)  [TUFLIB]
is string (head) head of (str)  [TUFLIB]
has string (str) head (head)  [TUFLIB]
is string (key) in (tgt) from (pos)  [TUFLIB]
is string (str) raw  [RTS]
is string (str) starting with lower case  [STRINGS]
is string (str) starting with upper case  [STRINGS]
is string (head) starting (str)  [TUFLIB]
is string (tail) tail of (str)  [TUFLIB]
last key (row)  [RTS]
map of fields from (bunch)  [RTS]
map (this) give indices  [RTS]
map (this) join keys by (sep)  [TUFLIB]
mark (fault) checked  [RTS]
max (vals)  [TUFLIB]
min (vals)  [TUFLIB]
parse options (args) with valopts (valopts)  [TUFLIB]
parse query string (str)  [TUFLIB]
print partial (mixed)  [STRINGS]
replace character at (pos) in (str) by (repl)  [TUFLIB]
replace each (cue) by (repl) in string (target)  [TUFLIB]
replace string at (pos) in (str) by (repl)  [TUFLIB]
replace string from (from) upto (to) in (str) by (repl)  [TUFLIB]
round (an)  [RTS]
rounded from (str)  [STRINGS]
row of filenames from directory (dir)  [TUFLIB]
row of lines from command (cmd)  [TUFLIB]
row of lines from file (filename)  [TUFLIB]
row (row) give indices  [RTS]
runtime statistics enable  [RTS]
seconds cpu time  [RTS]
seconds since epoch  [RTS]
set fields in (bunch) from (map)  [RTS]
sign (item)  [RTS]
sleep (seconds) seconds  [RTS]
string from boolean (b)  [STRINGS]
string from number (num)  [STRINGS]
string (src) clip from (first)  [STRINGS]
string (src) clip from (first) length (len)  [STRINGS]
string (str) clip from (start) many of (accept)  [TUFLIB]
string (src) clip from (start) none of (reject)  [TUFLIB]
string (src) clip from (first) upto (last)  [STRINGS]
string (src) clip upto (last)  [STRINGS]
string (str) give parts cut by any of (seps)  [TUFLIB]
string (str) give parts cut by many of (seps)  [TUFLIB]
string (args) parse options (valopts)  [TUFLIB]
tag (item) by (tag)  [RTS]
to float (str)  [STRINGS]
to float (str) else (default)  [TUFLIB]
to integer (str)  [TUFLIB]
to integer (str) else (default)  [TUFLIB]
trunc (an)  [RTS]

Documentation

TUFPL_rts.c

debug dump used items  [RTS]
print a dump of all used items to stderr
(if debug enabled)

count of (item)  [RTS]
Supply the number of elements (row, map, tuple),
bytes (chunk), characters (code points, string).
Same as attribute .Count
Usful e.g. as (count of num _ '') to give the number of digits

count (item)  [RTS] Deprecated.
No documentation

bytes of (item)  [RTS] Deprecated.
Supply the number of bytes used
Not required for expressions, use attribute .Bytes

math abs (item)  [RTS]
Absolute value of a number

abs (item)  [RTS] Deprecated.
Alias for 'math abs ()'

math sign (item)  [RTS]
Sign of a number

sign (item)  [RTS] Deprecated.
Alias for 'math sign ()'

string (str) is raw  [RTS]
Is string a raw string

is string (str) raw  [RTS] Deprecated.
Alias for 'string () is raw'

string (str) is ascii  [RTS]
Is string an ASCII string

is string (str) ascii  [RTS] Deprecated.
Alias for 'string () is ascii'

last key (row)  [RTS] Deprecated.
Last key of a row; same as .last

first key (row)  [RTS] Deprecated.
First key of a row; same as .first

is (x) fault  [RTS]
True if item is a fault item

fault (item) mark checked  [RTS] Deprecated.
Increase acknowledge count of an error item.
Same as x:checked =+ 1

fault (fault) is checked  [RTS] Deprecated.
Alias for: fault (item) mark checked

mark (fault) checked  [RTS] Deprecated.
Alias for: fault (item) mark checked

tag (item) by (tag)  [RTS] Deprecated.
Set tag attribute
Not required for expressions, set control field .Tag

bunch (bunch) lock  [RTS]
Increase the lock count of a row or map.
When the lock count is not zero, the item becomes temporarily immutable.

bunch (bunch) unlock  [RTS]
Decrease the lock count of a row or map.
If the lock count is still not zero, the item is still immutable.
If the lock count was zero, it is not changed, but a fault item returned.

chunk (chunk) set byteorder (char)  [RTS]
Set byte order attribute in chunks

is (x) void  [RTS]
check if void; same as x = ()

is (x) boolean  [RTS]
check if boolean; same as x .= ?- or x.kind = 'boolean'

is (x) integer  [RTS]
check if integer; same as x .= 0 or x.kind = 'integer'

is (x) rational  [RTS]
check if rational; same as x .= 1/2 or x.kind = 'rational'

is (x) float  [RTS]
check if float; same as x .= 0.0 or x.kind = 'float'

is (x) number  [RTS]
check if number; same as (x .= 0 | x .= 1/2 | x .= 0.0)

is (x) string  [RTS]
check if string; same as x .= '' or x.kind = 'string'

is (x) row  [RTS]
check if row; same as x .= [] or x.kind = 'row'

is (x) map  [RTS]
check if map; same as x .= {} or x.kind = 'map'

is (x) chunk  [RTS]
check if chunk; same as x.kind = 'chunk'

is (x) function  [RTS]
check if function; same as x.kind = 'function'

is (x) tuple  [RTS]
check if tuple; same as x.kind = 'tuple'

is (x) odd  [RTS]
Test if integer is odd.
Returns boolean, not integer (use x %% 2 to obtain an integer)

bit (n) is set in (x)  [RTS]
Test the n-th bit of an integer number.
Negative targets are tolerated and treated as in two's complement,
even for big integers.
Returns boolean, not integer (use (x // 2^n) %% 2 to obtain an integer)

new row  [RTS]
new empty row factory function
Should never fail with a fatal runtime error.
See: new row size ()

new row size (cells)  [RTS]
new row factory function
Create a new row with minimum number of pre-allocated cells.
A fault item may be returned on failure.
Note that many operating systems use optimistic
allocation and may return success,
but kill the process later if memory is really exhausted.

row (row) give keys  [RTS]
Scan gives keys of non-void row elements
The row may be modified or even another one while scanned;
just the keys are enumerated and void cells skipped.
Elements added during the scan at the upper end (high keys) are found,
those at the lower end (low keys) not.
To deliver all keys, use: from row.first upto row.last

row (row) give indices  [RTS] Deprecated.
Alias for 'row (row) give keys'

give indices of row (row)  [RTS] Deprecated.
Alias for 'row (row) give keys'

row (row) give values  [RTS]
Scan gives values of a row (ascending keys)
Void entries are not supplied.

row (row) sort fast using (func)  [RTS]
Sort the values in a row (vector) using the C library routine.
If the compare funtion (func) is void, the TUF operator '>' is used
for ascending numbers or strings.
Otherwise it must be a function reference that returns an integer:
> 0 for a > b
= 0 for a = b
< 0 for a < b
Invert the sign for descending sort.
Sort may be unstable, i.e. changing the order of equal items;
for a stable sort use 'row (row) sort ascending using (func)'
The row reference is returned in case the argument is from a function.
The indices remain, i.e. .last and .first are unchanged,
just the values are in given order.

sort (row) fast using (func)  [RTS]
Alias for: row (row) sort fast using ()

row (row) sort fast ascending  [RTS]
Sort the values of a row ascending using the C library routine.
Shortcut for 'row (row) sort fast using ()'

row (row) sort fast descending  [RTS]
Sort the values of a row descending using the C library routine.

sort (row) fast ascending  [RTS]
Alias for: row (row) sort fast ascending

sort (row) fast descending  [RTS]
Alias for: row (row) sort fast descending

row (row) sort using (func)  [RTS]
Sort a row (vector) in place for ascending values.
If the compare funtion (func) is void, the standard TUF operator '>'
is used, must be applicable for all values and gives ascending values.
Otherwise, it must be a function reference that returns an integer
> 0 for a > b
= 0 for a = b
< 0 for a < b
Invert the sign for descending.
Method used is in-place insert sort, which has low overhead
for small sets and moderate speed for larger sets,
and is stable, i.e. keeps the order of equal elements.
For large sets (>10000) use e.g. row (row) sort fast using (func).
The row reference is returned in case the argument is from a function.

sort (row) using (func)  [RTS]
Alias for: row (row) sort using (func)

row (row) sort ascending  [RTS]
Sort a row (vector) ascending.
Shortcut for: row (row) sort using ()

sort (row) ascending  [RTS]
Alias for: row (row) sort ascending

row (row) sort descending  [RTS]
Sort a row (vector) descending.
See 'row (row) sort using (func)'
but using '<' instead of '>'

sort (row) descending  [RTS]
Alias for: row (row) sort descending

row (row) sort sync (val) using (func)  [RTS]
Sort a row (vector), and keep a second row (val) synchronous.
Avoids the creation of a row of pairs to be sorted.
Uses insert sort and might be slower than using fast sort with pairs.
See "row (row) sort using (func)"

sort (row) sync (val) using (func)  [RTS]
Alias for: row (row) sort sync (val) using (func)

row (row) sort sync (val) ascending  [RTS]
Shortcut for: row (row) sort sync (val) using ()

sort (row) sync (val) ascending  [RTS]
Alias for: row (row) sort sync (val) ascending

row (row) sort sync (val) descending  [RTS]
Shortcut for: row (row) sort sync (val) using ()
but with inverted compare

sort (row) sync (val) descending  [RTS]
Alias for: row (row) sort sync (val) descending

new map  [RTS]
No documentation

map (this) key (key) add (value) unchecked  [RTS]
Quickly add element to a map allowing duplicates.
The element is added without searching for the key,
hiding, but not removing any previously set value.
If the value is void, the most recent one is deleted,
as with the ordinay map access.
Improper use of this function may degrade performance.

map (this) keys as row  [RTS]
Provide the keys of a map as a row in undefined order.
May supply keys more than once on maps where .UniqueKeys is off
To have the keys sorted, use e.g.
row (map this keys as row) sort fast ascending

map (this) keys  [RTS]
Alias of: map () keys as row

map (this) values as row  [RTS]
Provide the values of a map as a row in undefined order.
Values for duplicate keys are correspondingly duplicated.
Functionally equivalent to:
rv =: new row size this.count
?# key =: map this give keys
rv[] =: this{key}

map (this) values  [RTS]
Alias of: map () values as row

map (this) key value pairs as row  [RTS]
Provide key-value-pairs of a map as a row in undefined order.
Values for duplicate keys are correspondingly duplicated.
Functionally equivalent to:
rv =: new row size this.count
?# key =: map this give keys
rv[] =: key, this{key}

map (this) give keys  [RTS]
Scan to provide the keys of a map in undefined order.
The keys are saved at the first call, so it is equivalent to:
mr =: map (m) keys as row
?# key =: row mr give values	\ the row values are the map keys
:> key
May supply duplicate keys if 'map () key () add () unchecked'
was used (.UniqueKeys is false),
and keys for cells deleted meanwhile.

map (this) give indices  [RTS] Deprecated.
Deprecated alias for 'map () give keys'

give indices of map (map)  [RTS] Deprecated.
Deprecated alias for 'map () give keys'

map (this) give values  [RTS]
Map scan provides values unsorted.
The set of keys is saved at start,
and the values are taken from the actual map.
Void values are skipped like in a row scan.

map (this) give key value pairs  [RTS]
Map scan provides key-value pairs unsorted.
The set of keys is saved at start,
and the values are taken from the actual map.
Void values are skipped like in a row scan.

row (row) as tuple  [RTS]
Create a tuple dynamically and fill it with row elements,
Void elements are retained to keep the set of keys

new tuple size (count) values (vals)  [RTS]
New tuple with all elements equal.
If one with diferent values is needed, use: row (row) as tuple

tuple (tuple) give keys  [RTS]
Scann to provide keys of a tuple (ascending)
In contrast to rows, all keys are returned, even if the value is void

tuple (tuple) give values  [RTS]
Scan to provide values of a tuple in ascending index order.
In contrast to rows, void values are not suppressed

give keys (bunch)  [RTS]
Lazy scan that uses '{row, map, tuple} (rmt) give keys'
by determining the kind on the fly

give (bunch) keys  [RTS] Deprecated.
Alias for give keys (bunc)

give (bunch) indices  [RTS] Deprecated.
Lazy scan that uses '{row, map, tuple} (rmt) give keys'
by determining the kind on the fly

give values (bunch)  [RTS]
Lazy scan that uses '{row, map, tuple} (rmt) give values'
by determining the kind on the fly
No fault, only void return if neither row, map or tuple

give (bunch) values  [RTS] Deprecated.
Alias for give values (bunch)

integer (an)  [RTS] Deprecated.
Truncate floating point to nearest integer (.int)

math trunc (an)  [RTS]
Truncate floating point to nearest integer (.int)

trunc (an)  [RTS] Deprecated.
Deprecated for 'math trunc ()'

math round (an)  [RTS]
Round floating pointto nearest integer (.round)

round (an)  [RTS] Deprecated.
Deprecated for 'math round ()'

math ceil (an)  [RTS]
Smallest integer greater or equal (.ceil)

ceil (an)  [RTS] Deprecated.
Deprecated for 'math ceil ()'

math floor (an)  [RTS]
Largest integer less or equal (.floor)

floor (an)  [RTS] Deprecated.
Deprecated for 'math floor ()'

math float (x)  [RTS]
Convert accurate (integer or rational) to approximate (floating point) number.
Same as .float attribute or ## operator.
Returns a copy if already a float.
Returns 0.0 if void.
No runtime errors, just void if not a number.
Note that void is treated as zero in additions, not in mulitplications

float (x)  [RTS] Deprecated.
Deprecated for 'math float ()'

system process fork  [RTS]
Spawn a process, i.e. create a new process called child process.
Returns the integer 0 within the child process,
and the process id in the parent process.

system process wait  [RTS]
Wait for state changes in a child of the calling process,
i.e. wait for any child to die,
and return the process id of that child.

system process own id  [RTS]
get my process id

system process kill (pn) with (signo)  [RTS]
Kill process with number 'pn', using signal 'signo',
given as integer. See 'man 7 signal'.

system process kill (pn)  [RTS]
Kill process with number 'pn', using singal SIGTERM.

bunch (bunch) get fields  [RTS]
Create a map that maps all fields.
If the argument is not a row, map, fault item or chunk,
void is returned, not a fault item.
May be used in conjuntion with 'set fields to transfer fields.

map of fields from (bunch)  [RTS] Deprecated.
Alias for: bunch (bunch) get fields

bunch (bunch) set fields (map)  [RTS]
Change the fields of a bunch with the values given in an map.
The keys must be words, returns fault item if not;
otherwise void is returned, not the bunch reference.
Attempts to set attributes are silently ignored.
TODO: ignore known control fields, or all that begin with capitals

set fields in (bunch) from (map)  [RTS] Deprecated.
Alias for: bunch (bunch) set fields (map)

call (func) with (parm)  [RTS]
call function (func) with one parameter
return void if func is void

call (func) with (parm1) and (parm2)  [RTS]
call function (func) with two parameters
return void if func is void

call (func) with (parm1) and (parm2) and (parm3)  [RTS]
call function (func) with three parameters
return void if func is void

call (func) using (parm)  [RTS] Deprecated.
call function (func) with one parameter
return void if func is void

call (func) using (parm1) and (parm2)  [RTS] Deprecated.
call function (func) with two parameters
return void if func is void

call (func) using (parm1) and (parm2) and (parm3)  [RTS] Deprecated.
call function (func) with three parameters
return void if func is void

call function (func) using (parm)  [RTS] Deprecated.
No documentation

call function (func) using (parm1) and (parm2)  [RTS] Deprecated.
No documentation

call function (func) using (parm1) and (parm2) and (parm3)  [RTS] Deprecated.
No documentation

system exit (retcode)  [RTS]
Stop the programme immediately and exit to the caller.
No internal cleanup is done,
in particular no check for memory leaks.
Graceful exit with check is done via return of the main function.

new fault code (code) message (msg)  [RTS]
Create a fault item
.errmsg and .errcode are parameters
.errinfo is not yet set
Fault items do not have attributes,
just fields.

new fault item with code (code) and message (msg)  [RTS] Deprecated.
Alias for: new fault code (code) message (msg)

debug dump (x)  [RTS]
Dump information for item to standard error,
if debug output is enabled

debug info (x)  [RTS]
information on item without full tree dump
if debug output is enabled

system info enable  [RTS]
Enable runtime report

runtime statistics enable  [RTS] Deprecated.
No documentation

system info disable  [RTS]
Disable runtime report

debug enable  [RTS]
Enable debug output

debug disable  [RTS]
Disable debug output

debug is enabled  [RTS]
Check if debug is enabled

system set locale (cat) to (val)  [RTS]
Set a certain locale to a value given a string.
Locales to set are:
ALL, COLLATE, CTYPE, MESSAGES, MONETARY, NUMERIC, TIME

system set locale  [RTS]
Set locale as given in the environment variables.
If not called, the locale will be 'C',
i.e. not automatically used.

system get locale  [RTS]
Obtain current locale string

system get locale numeric  [RTS]
Obtain current locale numeric formatting informaton
Returns a map with the fields:
.dpoint 	string between unit digis and fractional digits
.groupsep	string to insert before each group of digits
Not yet:
.grouping	tuple of integer for the number of digits per group

system get environment  [RTS]
Get the environment, i.e. the shell variables,
and return a map of variable names and (string) values.

system epoch seconds  [RTS]
Get the current time as seconds since the epoch,
i.e. since 1970-01-01 00:00:00 +0000 (UTC)
Its purpose is to provide consistent time stamps,
so leap seconds are ignored
and all years divisible by 4 are leap years.

seconds since epoch  [RTS] Deprecated.
Alias for: system epoch seconds

time (seconds) unpack local as map  [RTS]
Deliver local time and date as fields of a map res:
res.sec		seconds 0..60 (60 for leap seconds)
res.min		minutes 0..59
res.hour	hours 0..23
res.day		day of the month 1..31
res.month	month 1..12
res.year	year > 1970
res.wday	day of the week 1..6 (monday = 1)
res.yday	day in the year 1..365 (1 jan = 1)
res.isDST	is daylight saving time
res.offUTC	seconds east of UTC
res.timezone timezone abbreviation (string)

time (seconds) unpack as map  [RTS]
Deliver UTC time and date as fields of a map res,
fields see localized version

time (seconds) format (fmt)  [RTS]
Provide formatting of a time stamp localized.
Formatting is done using the 'strftime' function;
see its manual page for format codes.
The result must not execeed 200 characters (bytes).
The format must be an ASCII string, as multibyte
characters could contain the conversion byte '%'.
If the size of the buffer is exceeded, the empty string
is returned (due to strftime interface),
which may also be the case for some format codes.

system cpu seconds  [RTS]
Get the cpu-time used so far in seconds as a floating point number
It might overflow (cross zero) on e.g. 72 minutes, and does not start at zero
For detailled times, use 'system cpu times'

seconds cpu time  [RTS] Deprecated.
Alias for: system cpu seconds

system cpu times  [RTS]
Get the cpu-times used so far in seconds as a floating point number
Returns a map with the fields:
.utime	user time for current process (whithout chlildren)
.stime	system time as above
.cutime	sums of .utime values for the current and all terminated children
.sutime same as above for .stime
For detailled times, use 'system cpu times'

system sleep (seconds)  [RTS]
Suspend execution for a given interval given in seconds
May use float to sleep for microsencod upto 1 second
Use sparingly, only if there is no wait for an event possible

sleep (seconds) seconds  [RTS] Deprecated.
Alias for: sleep (seconds) seconds

random set seed (seed)  [RTS]
Sets the seed for 'random next integer' simple pseudo random number generator
If the argument is void, the current time in seconds is used

random next integer  [RTS]
Supply another simple pseudo random integer
Range is 0 to $SYSTEM.randmax (both inclusive)

system set groupsep (dg)  [RTS]
Set integer grouping character when numbers are converted to a string
May be set to the (initial) void.

TUFPL_strings.c

system set string localization map (ary)  [STRINGS]
Set the string localization map
The previous one is returned.

string (str) check ascii  [STRINGS]
Check if a string is ASCII.
Re-scan the string and set in particular the .isascii attribute
As strings are immutable, a copy is returned if .isascii is changed,
orignal returned otherwise (including void)

string (src) from (first) length (len)  [STRINGS]
Copy the part of the string 'src' from 'first' upto 'length' characters.
'first' may be less than zero to denote counting from the end
(-1 is the last character, i.e. 'src.count').
If 'first' is zero, a fatal runtime error is caused.
If 'len' is zero or negative, the empty string is returned.
Attempts to exceed the string limits are silently truncated.
If 'src' is an empty string, the empty string is returned;
If 'src' is void, void is returned.
If the whole string is selected, it is not copied,
but the reference returned instead.

string (src) clip from (first) length (len)  [STRINGS] Deprecated.
Alias for 'string (src) from (first) length (len)

clip (src) from (first) length (len)  [STRINGS] Deprecated.
Alias for 'string (src) clip from (first) length (len)

string (src) from (first) upto (last)  [STRINGS]
Copy the part of the string 'src' from 'first' to 'last'.
'first' and 'last' may be less than zero to denote counting from the end
(-1 is the last character, i.e. at 'src.count').
If 'first' is zero, the empty string is returned.
If 'last' is zero, the whole string is returned.
Attempts to exceed the string limits are silently truncated.
If 'src' is an empty string, the empty string is returned;
If 'src' is void, void is returned.

string (src) clip from (first) upto (last)  [STRINGS] Deprecated.
Alias for 'string (src) from (first) upto (last)

clip (src) from (first) upto (last)  [STRINGS] Deprecated.
Alias for 'string (src) from (first) upto (last)

string (src) from (first)  [STRINGS]
Copy the part of the string 'src' that starts at 'first' upto the end.
Equivalent to 'string (src) clip from (first) upto (src.count)'

string (src) clip from (first)  [STRINGS] Deprecated.
Alias for 'string (src) from (first)'

clip (src) from (first)  [STRINGS] Deprecated.
Alias for 'string (src) from (first)'

string (src) upto (last)  [STRINGS]
Copy the part of the string 'src' upto the 'last' character.
Equivalent to 'string (src) clip from (1) upto (last)'

string (src) clip upto (last)  [STRINGS] Deprecated.
Alias for 'string (src) upto (last)

clip (src) upto (last)  [STRINGS] Deprecated.
Alias for 'string (src) clip from (first) upto (last)

string (str) locate (needle)  [STRINGS]
In string 'str', locate the string 'needle'.
On success, return the start position.
On failure, return integer zero.
If 'needle' is the empty string, the result is 1.
If 'needle' is void, the result is 0
If 'str' is void, the result is void.

string (str) locate (needle) from (start)  [STRINGS]
In string 'str', locate the string 'needle', starting at 'start'.
Start may be negative and then counts from the end (-1 is the last
character), but may neither be 0 nor void.
On success, return the start position, which may be negative.
On failure, return integer zero.
If 'needle' is the empty string, the result is 1.
If 'needle' is void, the result is 0.
If 'str' is void, the result is void.

string (str) times (ni)  [STRINGS]
Concatenate string 'str' for 'ni' times, without delimiters.
If the source string is empty, or the count (ni) is zero or void,
the target string is the empty string.
The source must be a string, and cannot be void.

string (str) as integer clib (base)  [STRINGS]
Convert 'str' to an integer number detremined by 'base'
using the existing library function 'strtol'.
String 'str' may begin with an arbitrary amount of white space,
followed  by  a  single optional '+' or '-' sign.
If base is void or 0, the base is determined by a prefix (after a sign):
If it is '0x' or '0X', the base is 16; if it is 0, the base is 8.
Otherwise, the default base is 10.
If the base is 16, a prefix of '0x' or '0X' is optional.
In bases above 10, the letter 'A' in  either  upper- or lowercase
represents 10, 'B' represents 11, and so forth, with 'Z' representing 35.
Using bases above 36 is not recommended, although it may work.
See 'string (str) as integer base (basespec)' as alternative.
Deviating from 'strtol', the string may not contain arbitrary
characters after a valid number, only white space,
otherwise a fault item is returned.
An empty string returns integer 0.
Void returns void for easier map handling.
See also 'string (str) as integer base (basespec)'.
Arbitrary precision integers are supported.

as integer (str) clib (base)  [STRINGS] Deprecated.
Alias for: string (str) as integer clib (base)

as c integer (str)  [STRINGS]
Alias for: string (str) as integer clib (0)
i.e. using C conventions

integer from (str) base (base)  [STRINGS] Deprecated.
Alias for: string (str) as integer clib (0)
i.e. using C conventions

string (str) as float  [STRINGS]
Convert the string 'str' to a rounded (floating point) number.
using 'strtod', which besides decimal numbers like '3.5E-9'
also allows hexadecimal number like '0x123P3' for 123*2^3.
Only blanks may enclose the number.
Returns fault item on error.
Return void from void as with integers.

as float (str)  [STRINGS]
Alias for: string (str) as float

to float (str)  [STRINGS] Deprecated.
Alias for: string (str) as float

float from (str)  [STRINGS] Deprecated.
Alias for: string (str) as float

rounded from (str)  [STRINGS] Deprecated.
Alias for: string (str) as float

cformat (format) (num)  [STRINGS]
Format a single number using C library '(s)printf' formats,
see its manual page for format codes.
First parameter (format) is the format string,
second an integer or a float.
Integers are 64-bit, i.e. long long int, thus use "%lld".
Floats are double.
The format string is not checked and must be ASCII only.
It must produce less than 333 characters, or a fault item is returned.
(The format '%.16f' for the maximum number 1E308 produces 324 digits.)
Neither rationals nor arbitrary precision (big) numbers can be used.
A void argument returns void.

cformat (format) number(num)  [STRINGS]
Alias for: 	cformat (format) (num)

format number using (format) for (num)  [STRINGS] Deprecated.
Alias for: 	cformat (format) number (num)

format (num) using (format)  [STRINGS] Deprecated.
Alias for: 	cformat (format) number (num)

float (num) as string  [STRINGS]
Returns a (decimal) string converted from a float.
Floating point numbers are shown with upto 6 decimal places
or in exponential form, similar to %G by printf,
but with always a decimal point and at least one digit behind.
This is the same format used for combining strings with numbers.

number (num) as string  [STRINGS]
Returns a (decimal) string converted from any kind of number.
For integers, just the digits (and a leading minus) are given;
for rationals, two numbers separated by a slash (e.g. -3/4).
Floating point numbers are shown with upto 6 decimal places
or in exponential form, similar to %G by printf,
but with always a decimal point and at least one digit behind.
This is the same format used for combining strings with numbers.
The result is groupd by decimal digits by the function
Void returns void, and any other kind a fault item;
this may make map handling easier.

as string (num)  [STRINGS]
Alias for: number (num) as string

string from number (num)  [STRINGS] Deprecated.
Alias for: number (num) as string

boolean (b) as string  [STRINGS]
returns a boolean as string '?+' or '?-'
Void returns void for easier map handling.

string from boolean (b)  [STRINGS] Deprecated.
Alias for 'boolean (b) as string'

integer (i) code point as string  [STRINGS]
convert a character code (code point in Unicode terminology)
to a one-character length string.
The code point must be a non-negative number in the range of Unicode code points.

string (str) code point at (pos)  [STRINGS]
Give the integer character code (code point in Unicode terminology)
of the character at 'pos' in string 'str', 1 is the first character.
If 'pos' is less zero, it is counted from the end, -1 is the last character.
If 'pos' is zero or beyond the size of the string, null is returned,
as integer 0 is a valid code point.

string (str) starts upper case  [STRINGS]
Tests the first character in string (str) for upper case.
Returns ?+ if it is upper case (not the negation of lower case).
return ?- if not or empty string.
Void is returned as void.
Is not the negation of lower case test.
Call 'system set locale' to check for non-ASCII characters

is string (str) starting with upper case  [STRINGS] Deprecated.
No documentation

string (str) starts lower case  [STRINGS]
Tests the first character in string (str) for lower case.
Returns ?+ if it is lower case (not the negation of upper case).
return ?- if not or empty string.
Void is returned as void.
Call 'system set locale' to check for non-ASCII characters

is string (str) starting with lower case  [STRINGS] Deprecated.
No documentation

string (str) in upper case  [STRINGS]
Convert string characters to upper case
Void is returned void, empty string unchanged
Call 'set locale' to convert non-ASCII characters

string (str) in lower case  [STRINGS]
Convert string characters to lower case
Void is returned void, empty string unchanged
Call 'set locale' to convert non-ASCII characters

string (str) hash  [STRINGS]
Hash function for strings
returns an (32bit) integer number calculated iteratively by
sum =: sum * 19 + byte[i] mod 2^31
where  byte[i] is the i-th byte (not code point)
and the sum starts with the number of bytes.

string (str) decode percent encoding  [STRINGS]
replace all occurences of %xx with single bytes, as is used for
HTML query strings including UTF-8 encoded characters.
Replacement of '+' by space is not done.
The result is marked as ASCII or RAW, unless it is valid UTF-8.
Input markings of ACSCII and RAW are ignored, and UTF-8 strings
are treated bytewise, not characterwise.
E.g. "a%DCöx" is very dubious, but allowed by the standard,
and result in a string with the .raw attribute set.
Note that %25 results in a '#' character in the output.
If '#' is not followed by two hex digits, it is copied to the output
and scanning continues with the next character.
Normally, input should only be strings with the .ascii atribute set.
Newline characters are silently ignored and not copied.

print (mixed) nonl  [STRINGS]
print an item in default format to standard output,
without trailing line feed
If output is a terminal, stdout is flushed

print partial (mixed)  [STRINGS] Deprecated.
print an item in default format to standard output,
without trailing line feed
Deprecated, use print (mixed) nonl

print (mixed)  [STRINGS]
print item in default format to standard output,
followed  by a line feed.
If output is a terminal, stdout is flushed

error print (mixed) nonl  [STRINGS]
print an item in default format to standard error,
without trailing line feed
Stream stderr is flushed even if not a terminal

error print (mixed)  [STRINGS]
print item in default format to standard error,
followed  by a line feed.
Stream stderr is flushed even if not a terminal

debug print (mixed) nonl  [STRINGS]
Print argument without linefeed to standard error
if the global DEBUG flag is set.

debug print (mixed)  [STRINGS]
Print argument and linefeed to standard error
if the global DEBUG flag is set.

debug print lno (mixed)  [STRINGS]
Print source linenumber and argument to standard error
if the global DEBUG flag is set.
Same as: debug print '@&lineno;:',  _ mixed'

debug print here (mixed)  [STRINGS]
Print source position and argument to standard error
if the global DEBUG flag is set.
Same as: debug print '&filename;@&lineno;:',  _ mixed'

debug print calls (depth)  [STRINGS]
print the current function call stack to stderr
(depth) may be void or zero for no limitation,
or a non-zero integer to limit the number of entries.

debug print stack (depth)  [STRINGS] Deprecated.
Alias for: debug print calls (depth)

TUFPL_inout.c

system standard input  [INOUT]
file handle for the standard input stream

system standard output  [INOUT]
file handle for the standard output stream

system standard error  [INOUT]
file handle for the standard error stream

new file stream filename (fn) mode (str)  [INOUT]
Open a file for linewise access
Mode indicators are:
'r' 	reading only, file must exist
'r+'	reading and writing, file must exist
'w' 	writing only, truncated or newly created
'w+'	reading and writing; truncated or newly created
'a' 	appending only; empty file created if not existiing
'a+'	reading and writing, position to end initially, created if not existing
On error, a fault item is returned with
.errno	the system error integer number
.msg	the corresponding string
.info	not set

new file stream reads (fn)  [INOUT]
Open a file for linewise reading only.
The file must already exist.
Reading starts at the first byte.
Same as mode 'r'

new file stream modifies (fn)  [INOUT]
Open a file for linewise reading and writing.
The file must already exist.
There is one common file position, that is
advanced by both, reading and writing.
Same as mode 'r+'

new file stream rewrites (fn)  [INOUT]
Open a file for linewise writing only.
Truncated if it exists, created otherwise.
Same as mode 'w'

new file stream replaces (fn)  [INOUT]
Open a file for linewise reading and writing.
Truncated if it exists, created otherwise.
Starts at the beginning of the file.
Same as mode 'w+'

new file stream appends (fn)  [INOUT]
Open a file for append writing only
Created if the file does not exist.
Any write appends data to the current end of the file.
Same as mode 'a'

new file stream updates (fn)  [INOUT]
Open a file for linewise reading and appending
Reading starts at the first byte and advances the position,
but any write appends data to the end of the file,
leaving the position after the last byte written.
If the file does not exist, it is created.
Same as mode 'a+'

file stream (stream) close  [INOUT]
Drops, i.e. closes, a file stream.
Although streams are closed automatically when the item is discarded,
errors can only be captured with a explicit close,
otherwise they are a fatal runtime error.
Returns the null reference on success.
If an error occured, a fault item is returned.

file stream (fd) flush  [INOUT]
Flushes a file stream, i.e. drains internal buffers
so that the data is available for other processes
Avoid flushing of read-only streams
Returns null or a fault item.

file stream (fd) tell  [INOUT]
Returns an integer giving the current file position,
which is a byte number.
Note that unless the stream is read as raw strings,
this number may be larger than the number of characters
if UTF-8 encoded bytes are present.
a fault item is returned if the stream is not seekable,
e.g. a pipe or standard input from a terminal.

file stream (fd) seek (loc)  [INOUT]
sets the current file position of 'stream' to byte number 'loc',
counted from the beginning.
Note that for UNIX file semantics, positioning behind the end
is possible and extends the file.
a fault item is returned if the stream is not seekable,
e.g. a pipe or standard input from a terminal.

file stream (fd) get  [INOUT]
Returns the next line from 'stream' as a string.
Line delimiters are linefeed characters.
The line is always scanned and marked as RAW, ASCII or UTF-8.
If the file is at its end, null is returned.
The delimiting line feed character is **not** part of the returned string,
and any trailing carriage return character is also removed.
Thus, using this interface, there is no difference
whether the last character of a (text) file is a linefeed or not.
Note that UNIX streams use zero-terminated strings,
thus no zero byte will ever be part of the string.
If such a stream read is too restrictive,
use the basic unbuffered I/O (read and write).

file stream (fd) put (string)  [INOUT]
Writes the contents of the string 'line' to 'stream',
followed by a line feed character.
Thus, using this interface, there is no way to write a text file
that has not a line feed as last character.
If the string contains line feed characters,
these are not removed, even if this may be (ab-) used to write
more than one line in a single call.
Also, trailing carriage returns are not removed,
but do not show if the file read in later as a stream.
Consequently, no partial lines can be written.
Note that UNIX streams use zero-terminate strings,
thus if the string contains zero bytes, it will be truncated there.
Return is always a null reference,
unless an error occured, and a fault item is returned.
If such a stream write is too restrictive,
use the basic unbuffered I/O.

file stream (fd) append (line) atomically  [INOUT]
Appends the string 'line' atomcially to 'stream'.
The stream must be opended in append mode.
The intended use is to use the buffered stream for reading only,
and append only with this function, even if buffers are flushed
before the write.
The stream is positioned then to current end of the file,
i.e. somewhere behind the data written.
Returns null if the write succeeds, and a fault item otherwise.

new command stream reads (command)  [INOUT]
Created a command pipe (command)
and a stream to read the command output.
If the environment variable 'TUFPL_NO_SHELL' is set,
this is a fatal error.

new command stream write (command)  [INOUT]
Created a command pipe (command)
and a stream to write the command input,
which normally will redirect its output to some file.
If the environment variable 'TUFPL_NO_SHELL' is set,
this is a fatal error.

command stream (fd) close  [INOUT]
Drops, i.e. closes, the stream.
Although streams are closed automatically when the item is discarded,
errors can only be captured with a explicit close.
If an error occured, a fault item is returned.
In order to avoid accidential loss of return codes,
if the return code of the command is not zero,
a fault item is returned too.

command stream (fd) get  [INOUT]
Return the next line from a command stream

command stream (fd) put(string)  [INOUT]
Writes the contents of a string to the given command (pipe) stream,
followed by a line feed character.
Return is always a null reference,
unless an error occured, and a fault item is returned.

file (filename) attributes  [INOUT]
Returns the attributs of a filename or open file stream
as a map with zero elements with user attributes:
The attribute 'ftype' returns a string, e.g.:
file, dir, cdev, bdev, fifo, socket
Integer valued attribs are:
inode, mode, links, uid, gid, size, atime, mtime, ctime, space
Boolean attribute:
symlink, directory
If the file does not exist, a fault item is returned.
The 'space' attribute gives the number of bytes allocated,
if this is less than 'size', the file is sparse.
The file item may be a string as a file name,
or an open stream, or an open chunk handle.
Note that symlinks are followed, so the information is that of the file;
however, this fact is signalled by the .symlink attribute to be true.
Information about the symlink itself cannot be obtained by this function.
The symlink attribute is also set if error code 2 is returned,
meaning that the symlink refers to file that no longer exists;
in this case, the error message is changed from 'No such file or directory'
to 'Symbolic link invalid'.
If the handle for an open file is used, the filename cannot be obtained,
as the number of filenames in directories can be from zero to many
any time after the file has been opened.
So it is not supplied for requests with a filename string.
Note that the access time '.atime' may be stale, if the filesystem is
mounted with the 'relatime' option, that updates the atime only
once within 24 hours, or if it is smaller than the others,
avoiding disk writes if files are only read.

file (filename) get attributes  [INOUT] Deprecated.
No documentation

attributes of file (filename)  [INOUT] Deprecated.
No documentation

file (filename) extended attribute (attrname)  [INOUT]
get value of extended file attribute (user space)
returns null if not set, a string, or a fault item
currently, the result is truncated to 1023 bytes, if longer

file (filename) extended attribute (attrname) set (value)  [INOUT]
set value of extended file attribute (user space)
returns null, or a fault item
if the value is null, the attribute is removed
removing a non-existent attribute is not an error

new directory stream reads (dirnam)  [INOUT]
Creates a stream to read directory entries line by line.

directory stream (fd) close  [INOUT]
Drop (close) a running directory stream

directory stream (fd) get  [INOUT]
Returns the next filename from a directory stream,
(in directory order).

file (oldfn) hard link to (newfn)  [INOUT]
Create a file (hard) link
returns null reference if ok, fault item otherwise

file (oldfn) symbolic link to (newfn)  [INOUT]
Create a file symbolic link
returns null reference if ok, fault item otherwise

directory (dirpath) create  [INOUT]
Creates a directory using a path.
returns null reference if ok, fault item otherwise

file (obsfn) unlink  [INOUT]
Unlinks a filename, i.e. deletes it from its directory,
which deletes the file if it has no more references
returns null reference if ok, fault item otherwise

file (filename) real pathname  [INOUT]
Determine canoncial absoulute pathename ('realname')

system current directory  [INOUT]
Get current (working) directory

file stream (stream) is tty  [INOUT]
check if a stream is connected to a Terminal
Argument is e.g. 'system standard output'
Returns ?+ if it is, ?- if not, fault item else

is input a tty  [INOUT] Deprecated.
Deprecated to check if a standard input is a terminal;
use 'file stream system standard input is tty' instead

is output a tty  [INOUT] Deprecated.
Deprecated to check if a standard output is a terminal
use 'file stream system standard output is tty'

string (string) matches filename (pattern)  [INOUT]
Check if string matches shell wildcard pattern
Backslashes are matched verbatim (not used as escape character)
Leading periods are not matched by * or ?
returns boolean true or false

new file chunk create (fn)  [INOUT]
open a file for unbuffered binary chunk reading and writing.
If the file does not yet exist, it is created, and permissions
are then set all minus umask, valid for future opens only.
If the file does exist, but without write permission,
a fault item is returned.

new file chunk read (fn)  [INOUT]
open a file for binary chunk reading.
No write permission is required on the file.
If the file does not exist, a fault item will be returned.

new file chunk modify (fn)  [INOUT]
open a file for binary chunk reading and writing.
Write permission is required.
If the file does not exist, or has no write permission,
a fault item will be returned.

new file chunk append (fn)  [INOUT]
open a file for binary chunk, reading and appending.
Each write is preceeded by setting the file position
to the end of the file, and then the buffer is written,
both atomically, if it's a local file system.
To re-read the written data, the position has to be
set back to where it was before the write.
Setting the position immediately before a write
has no effect.
If the file does not exist, a fault item will be returned.

file chunk (fd) close  [INOUT]
Drops, i.e. closes, a binary file IO
Although files are closed automatically when the item is discarded,
errors can only be captured with a explicit close,
otherwise they are a fatal runtime error.
Returns the null reference on success.
If an error occured, a fault item is returned.

file chunk (fd) read (ck) at (pos) size (size)  [INOUT]
Read a binary chunk from a file
returns the number of bytes read and changed in the chunk

file chunk (fd) write (ck) at (pos) size (size)  [INOUT]
write a binary chunk to a file
If  the  file  was opened for append, the  file offset is first set
to the end of the file before writing, both atomically.

file chunk (fd) tell position  [INOUT]
Obtain current position of a chunked file.
Returns an integer which is the zero based byte offset in the file

file chunk (fd) position (loc) start  [INOUT]
Position a chunked file relative to the start
'dist' must not be negative. Void is treated as 0.
Note: If the resultant position is beyond the current end,
no error is returned, but the space logically allocated to zero bytes.
Returns the new position relative to the start.

file chunk (fd) position (loc) current  [INOUT]
Position a chunked file relative to the current position.
'dist' may be negative. Void is treated as 0.
Note: If the resultant position is beyond the current end,
no error is returned, but the space logically allocated to zero bytes.
Returns the new position relative to the start.

file chunk (fd) position (loc) end  [INOUT]
Position a chunked file relative to the current end.
'dist' is often negative. Void is treated as 0.
Note: If the resultant position is beyond the current end (i.e. 'dist' is positive),
no error is returned, but the space logically allocated to zero bytes.
Returns the new position relative to the start.

new basic pipe  [INOUT]
Create a unidirectional pipe for interprocess I/O
A single pipe descriptor (system item) is returned,
that can be read or written to.
Normally, after the creation the process is forked
in one reading and one writing,
the reading one closing the pipe for writing,
the writing one closing the pipe for reading.
Otherwise the process may block.
Note that the UNIX system creates two file descriptors,
that are both handled in the system item (pipe descriptor)
Preliminary version with standard buffer length 4096
and no logical buffering.

basic pipe (pd) close reading  [INOUT]
Close the reading end of a basic pipe

basic pipe (pd) close writing  [INOUT]
Close the writing end of a basic pipe

basic pipe (pd) get  [INOUT]
Receive bytes at the reading end of a basic pipe as string.
A byte string of no more than 4096 bytes is read
and delivered as a string without ISO conversion,
but with UTF-8 and raw check.
The read blocks until data is available from the write end.
Returns void if the write counterpart is closed (end-of-file).

basic pipe (pd) put (str)  [INOUT]
Sends a string to the reading end of a basic pipe.
If the string could not be fully delivered in one
action, a fault item is returned, and the number of bytes
(not characters) given as string in the .info field;
note that in this case, the UTF-8 encoding for the last
character may be invalid on the receiving side.
Returns void on success.

TUFPL_math.c

math sin (arg)  [MATH]
Calculate the sinus of an approximate (floating point) number

math arc sin (arg)  [MATH]
Calculate the inverse sinus of an approximate (floating point) number

math cos (arg)  [MATH]
Calculate the cosinus of an approximate (floating point) number

math arc cos (arg)  [MATH]
Calculate the inverse cosinus of an approximate (floating point) number

math tan (arg)  [MATH]
Calculate the tanges of an approximate (floating point) number

math arc tan (arg)  [MATH]
Calculate the inverse tangens of an approximate (floating point) number

math arc tan (y) by (x)  [MATH]
Calculate the arc tangent function of two floats, i.e.
i.e. the principal value of the arc tangent of y/x,
using the signs of the two arguments to determine the quadrant of the result.
see man 3 atan2

math sqrt (arg)  [MATH]
Calculate the square root of an approximate (floating point) number

math exp (arg)  [MATH]
Calculate an approximate (floating point) number to the power of e

math base (base) exp (exponent)  [MATH]
Calculate an approximate (floating point) base
to the power of any (floating point) exponent
same as base^exponent, restricted to floating point numbers

math log (arg)  [MATH]
Calculate the natural logarithm (to the base e)

math lg (arg)  [MATH]
Calculate the logarithm to the base 10

math base (base) log (arg)  [MATH]
Calculate the logarithm to any base,
which is
(math log arg) / (math log base)

math int (arg) count digits (base)  [MATH]
Determine the size in (base) digits required to represent (arg),
either exact or +1, i.e. the number of digits required (without sign).
E.g. for base 2, ld(2) = 1, ld(3)=2, ld(1023)=10, ld(1024)=11
As a convenience, ld(0) = 0
If (base) is void, 10 is assumed.
if (arg) is void, 0 is returned independent of base.
Basically the same as 'count integer arg as string base base'

math int sqrt (n)  [MATH]
Integer square root (arbitrary precision)
Largest integer when squared does not exceed the argument
See 'is () square' how to test for a perfect square

TUFPL_chunk.c

new chunk size (size)  [CHUNK]
Create new byte chunk of given size (in bytes)
If there is no space, a fault item is returned

chunk (ck) zero at (offset) size (size)  [CHUNK]
Zero a chunk slice
The size must be positive, and offset and size are adjusted if out of range.
Returns the offset of the next byte behind the filled area.
.lock, .shut are honored, and .revs is incremented.

chunk (ck) zero at (offset)  [CHUNK]
Zero a chunk slice
shortcut for 'zero chunk (chnk) at (offset) size chnk.bytes

chunk (dk) zero  [CHUNK]
Zero a chunk slice
shortcut for 'zero chunk (chnk) at 0 size chnk.bytes

chunk (ck) slice at (offset) size (size)  [CHUNK]
Create a copy of a byte chunk slice:
A new chunk of the size given is created, and filled from the slice.
The offset may be negative and is then counted from the end.
The size given must be positive and determines the size of the new chunk.
If the offset exceeds the filled area, nothing is copied,
just the new chunk created uninitialized.
If there are less bytes at the offset than the size, only these
are copied, and the new chunk partially filled.
The byte order attribute is propagated.
If there is no space for the new bunch, a fault item is returned.

chunk (ck) get integer at (offset) size (size)  [CHUNK]
Extract integer from byte chunk.
The source bytes are given by an offset (zero based) and a size;
this must be fully within the chunk to avoid data corruption.
The result is always signed;
to obtain the unsigned equivalent, add 2^8=256, 256^2=65536, 256^3=16´777´216 etc.
if negative.
If more than one byte is fetched, a byte order must be set for the chunk.

chunk (ck) get string at (offset) size (size)  [CHUNK]
Extract string from a chunk slice.
The position may be negative, and is then counted from the end.
The size must not be negative, and is adjusted so that
the slice lies in the filled space.
If may become zero; then an empty string is returned.
The resulting string is checked for UTF-8,
but currently no autoconversion is implemented.
If the source is UTF-8 and a wrong size used, the resulting string
may be truncated inside an encoding and thus flagged '.raw'.

chunk (bcr) get string at (offset) size (size) until zero  [CHUNK]
Extract string from chunk and stop if a zero byte is found.
The position may be negative, and is then counted from the end.
The size must not be negative, and is adjusted so that
the slice lies in the filled space.
If may become zero; then an empty string is returned.
The resulting string is checked for UTF-8,
but currently no autoconversion is implemented.
If the source is UTF-8 and a wrong size used, the resulting string
may be truncated inside an encoding and thus flagged '.raw'.

chunk (bcr) get string at (offset) size (size) until linefeed  [CHUNK]
Extract string from chunk and stop if a linefeed is found.
The position may be negative, and is then counted from the end.
The size must not be negative, and is adjusted so that
the slice lies in the filled space.
If may become zero; then an empty string is returned.
If no linefeed is found, null is returned,
even if there are characters left.
The resulting string is checked for UTF-8,
but currently no autoconversion is implemented.
If the source is UTF-8 and a wrong size used, the resulting string
may be truncated inside an encoding and thus flagged '.raw'.

chunk (bcr) get string at (offset) size (size) until (stop)  [CHUNK]
Extract string from chunk and stop if a given character is found.
The position may be negative, and is then counted from the end.
The size must not be negative, and is adjusted so that
the slice lies in the filled space.
If may become zero; then an empty string is returned.
The resulting string is checked for UTF-8,
but currently no autoconversion is implemented.
If the source is UTF-8 and a wrong size used, the resulting string
may be truncated inside an encoding and thus flagged '.raw'.

chunk (tgt) put string (str) at (offset) size (len)  [CHUNK]
Replace a chunk slice by a string.
The position may be negative and is counted from the end.
The size must be at least the byte length of the string,
and all bytes must fit into the chunk.
If it is shorter, the remaining space is filled with zero bytes.
If the offset is beyond the filled space, zero bytes are
prepended.
Returns the offset of the next byte behind the area written to.
Attributes .lock, .shut are checked and .revs, .filled are set.

chunk (tgt) put integer (src) at (offset) size (size)  [CHUNK]
Replace a chunk slice with a binary integer.
The position may be negative and is counted from the end.
The size must be positive, and all bytes must fit into the chunk.
If the offset is beyond the filled space, zero bytes are prepended.
Returns the offset of the next byte behind the filled area.
Attributes .lock, .shut are checked and .revs, .filled are set.
Currently, only 1 to 8 bytes are supported.

chunk (tgt) at (toffset) size (tsize) put chunk (src) at (soffset) size (ssize)  [CHUNK]
Replace a chunk slice by a chunk slice
The positions may be negative and are counted from the end.
The target size must be at least the source size (no truncation).
If it is larger, the remaining space is filled with zero bytes.
If the target position is beyond the filled space, zero bytes are
prepended.
The chunks slices may overlap;
in this case, it works like an extra buffer is used
Returns the offset of the next byte behind the area written to.
Attributes .lock, .shut are checked and .revs, .filled are set.

TUFPL_tuflib.tuf

until void (val)  [TUFLIB]
Wrap a function into a scan.
Repeats until the value (val) is void or a fault item.
Do not wrap a scan function.

until zero (val)  [TUFLIB]
Wrap a function into a scan.
Repeats while the value (val) is an integer number unequal to zero.
Do not wrap a scan function.

until negative (val)  [TUFLIB]
Wrap a function into a scan.
Repeats while the value (val) is an integer less than zero
Do not wrap a scan function.

while positive (val)  [TUFLIB]
Wrap a function into a scan.
Repeats while the value (val) is an integer greater than zero
Do not wrap a scan function.

maximum of (vals)  [TUFLIB]
Return the largest value of a tuple, row or map
The values must be comparable by '<'
If not a row, tuple or map, return the argument

max of (vals)  [TUFLIB]
Alias for: maximum of (vals)

max (vals)  [TUFLIB] Deprecated.
Alias for: max of (vals)

minimum of (vals)  [TUFLIB]
Return the smallest value of a tuple, row or map
The values must be comparable by '<'
If not a row, tuple or map, return the argument

min of (vals)  [TUFLIB]
Alias for: minimum of (vals)

min (vals)  [TUFLIB] Deprecated.
Alias for: minimum of (vals)

from (first) downto (last)  [TUFLIB]
Generates integer numbers starting at (from) down to (last)
At end, the next value, i.e. (last-1), is returned.
The parameters must be integer numbers.

from (first) upto (last)  [TUFLIB]
Generates integer numbers starting at (from) up to (last)
At end, the next value, i.e. (last+1), is returned
The parameters must be integer numbers.

from (first) upto (last) step (step)  [TUFLIB]
Generates numbers starting at (first) up to (last) incremented by (step)
The step value is added, thus it must be positive to ensure termination
At end, the next value > (last) is returned
Parameters must be either accurate (integer or rational) or approximate (float)

from (first) downto (last) step (step)  [TUFLIB]
Generates numbers starting at (first) down to (last) decremented by (step)
The step value is subtracted, thus it must be positive to ensure termination
At end, the next value > (last) is returned
Parameters must be either accurate (integer or rational) or approximate (float)

from (first) to (last) step (step)  [TUFLIB]
Generates numbers starting at (first) adding (step)
Depending on the sign of (step), upto or downto (limit) is used.
Step must not be zero to avoid endlessness.
To be implemented in runtime system for loop context check and efficiency

from (start) upto (last) give tuples  [TUFLIB]
Generate pairs, triples etc
(start) and (last) must have the same number of elements
from (1,2) upto (2,4) give tuples
delivers in that order:
(1,2) (2,2), (1,3), (2,3), (1,4), (2,4)

new row (tagname)  [TUFLIB]
Create a tagged row.
Shortcut for:
rv =: new row
rv.tag := tagname

new row (tagname) size (sz)  [TUFLIB]
Create a tagged row wit an initial size.
Shortcut for:
rv =: new row size int
rv.tag := tagname

row (src) copy  [TUFLIB]
Copy a row's values, but not the fields
The set of keys remains the same (no renumbering)
else use e.g.
tgt =: [src.count]
?# sv =: row src give values
tgt[] =: sv

row (src) clone  [TUFLIB]
Create a row from another one including fields.

tuple (t) as row  [TUFLIB]
Create a row from a tuple

row (row) shrink  [TUFLIB]
Shrink row, i.e. return a copy without void elements, renumbered
If there are no void elements, the original is returned.
The first index is the same, even if it had a void cell.
Fields are preserved.

row (row) from (from) upto (upto)  [TUFLIB]
Copy row (row) starting with index (from) upto index (upto)
There is no check that (from <= row.first) or (upto >= row.last);
and all void elements are discarded,
i.e. all non-void elements starting with (from) are copied
from index 1 on to a new row, upto (upto) as last index processed.

row (row) append (rmt)  [TUFLIB]
Append a row, tuple or map to an existing row.
The non-void elements of (rmt) are added at the end of (row).

row (row) dedup  [TUFLIB]
Set duplicates void.
To remove all duplicate values, the values must be sorted,
as just the 2nd and all following references that are equal
to the 1st are voided.
Uses standard key scan, thus voids already there are ignored.
Often used in the sequence
row r sort fast ascending
row r dedup
row r shrink

tuple (tup) from (from) upto (upto)  [TUFLIB]
Copy tuple (tup) starting with index (from) upto index (upto)
There is no check that (from <= tup.first) or (upto >= tup.last);
and all void elements are discarded,
i.e. all non-void elements starting with (from) are copied
from index 1 on to a new tup, upto (upto) as last index processed.

row (row) keys  [TUFLIB]
Provide the keys with not void values as a row

row (row) values  [TUFLIB]
Provide the not void values as a row

is (key) in (set)  [TUFLIB]
Generalised check for an element within a set.
If the key and the set are strings, check if the key is in the string
(e.g. is str[i] in ##DecimalDigits)
If the key is the empty string, returns true.
Otherwise, the set must be a tuple, row or map,
and the key searched in the values.

is (key) not in (set)  [TUFLIB]
Shortcut for '~ is (key) in (set)'

row (row) as map  [TUFLIB]
Create a new map from a (sparse) row,
using the integer keys, ignoring void cells.

as map row (row)  [TUFLIB] Deprecated.
Alias for: row (row) as map

row (row) push (val)  [TUFLIB]
Push a non-void value to a row used as stack
As the '.count' attribute is used, values may not be void.
To create a stack, just create a row and push the first value.

row (row) pop  [TUFLIB]
Pop the top value of a row used as stack.
As void cannot be pushed, returns void if exhausted.
see: row (row) push (val)

new map (tagname)  [TUFLIB]
Create a tagged map, shortcut for:
rv =: new map
map.tag =: tagname
Note that tags may be set only once.

map (this) key value pairs as row  [TUFLIB]
Provide a row of key-value-pairs (unsorted)
Implemented as:
pairs =: new row size this.count
?# key =: map this give keys
pairs[] =: key, this{key}
:> pairs
Sorting by key is simple due to the comparison rules for tuples:
row (map this key value pairs as row) sort fast ascending

map (this) value key pairs as row  [TUFLIB]
Provide a row of value-key-pairs (unsorted)
Implemented as:
pairs =: new row size this.count
?# key =: map this give keys
pairs[] =:this{key}, key
:> pairs
Sorting by value is simple due to the comparison rules for tuples:
row (map this value key pairs as row) sort fast ascending

tuple (tup) as map by pairs  [TUFLIB]
Create a new map from a tuple of pairs,
e.g. ('a', 1), ('b', 2), ...
Duplicate keys overwrite the value.

as map tuple pairs (tup)  [TUFLIB]
Alias for: tuple (tup) as map by pairs

map (this) add pairs (rmt)  [TUFLIB]
Add to a map from a row, map or tuple of pairs.
Just a shortcut for:
?# lv =: give rmt values
this{lv.1} =: lv.2

map (this) copy lean  [TUFLIB]
Copy a map efficiently.
Fields are not copied (lean copy).
If the source has duplicate keys (must be created intentionally),
these are not preserved and the function may be slow.

map (this) copy  [TUFLIB]
Copy a map including fields efficiently.
Uses 'map () copy lean'.

map (this) keys not unique  [TUFLIB]
Provide a map of those keys that are not unique.
Allows mixed kinds of keys, i.e. only equality comparison is used.
If no such keys are found, void is returned,
as is if .UniqueKeys is true on entry

map (this) as string key (delim) value by (sep) quote (qr)  [TUFLIB]
Returns a string of key-value-pairs for a map
The values must be plain, i.e. numbers or strings or booleans.
Keys and values are joined using string (delim), default '=',
pairs are connected by string (sep), default blank ' '.
Both should be strings.
If (qr) is a reference to a function (with one parameter),
the return value is used, thus should be a string.
If (qr) is a string, the function `string () wrap qr` is used.
If (qr) is void, `quote ()` is used.
Note that 'quote ()' and 'string () wrap ()' also quote numbers;
use different quoting function if numbers shall be unquoted.

file (filename) lines  [TUFLIB]
Read file (filename) as lines into a row
If there is an error, the fault item received is returned unprocessed;
just the row of lines read so far is saved
in the .data attribute of the fault item

row of lines from file (filename)  [TUFLIB] Deprecated.
Alias for: file (filename) lines

file (filename) row of lines  [TUFLIB] Deprecated.
Alias for: file (filename) lines

file (filename) give lines  [TUFLIB]
Generates the lines of the file (filename) as a scan.
End-of-file is returned as void.
If the filename is void, standard input is used.
Fault items of lower level functions are given back as value.
In order to avoid infinite loops, fault items are only
returned once; the second call results in an assertion violation.

give lines from file (filename)  [TUFLIB] Deprecated.
Alias for: file (filename) give lines

file standard input give lines  [TUFLIB]
Generates the lines from standard input
See 'file (filename) give lines'

give lines from standard input  [TUFLIB] Deprecated.
Generates the lines from standard input
See 'file (filename) give lines'

directory (dir) give filenames  [TUFLIB]
Give the filenames in directory (dir) in directory order.
Returns a fault item if directory does not exist.
To scan sorted, use
dr =: sort directory dir filenames
?# fn =: row dr give values

give filenames of directory (dir)  [TUFLIB] Deprecated.
Alias for: directory (dir) give filenames

directory (dir) filenames  [TUFLIB]
Directory (dir) filenames unsorted as row.
Returns a fault item if directory does not exist.

row of filenames from directory (dir)  [TUFLIB] Deprecated.
Alias for: directory (dir) files

command string (cmd) give lines  [TUFLIB]
Generate the resulting lines when executing the command string (cmd) by the shell.
See 'quote (str) for shell' to protect special characters.
Fault items are given back as value.
In order to avoid infinite loops, fault items are only
returned once; the second call results in an assertion violation.
If the command string contains newline characters,
the shell may execute more than one command.

command (cmd) give lines  [TUFLIB]
Alias for: command string (cmd) give lines
Put the variablle in parenthesis if not found:
stream =: 'uname -a'
?# line =: command (stream) give lines

give lines of command (cmd)  [TUFLIB] Deprecated.
Alias for: command (cmd) give lines

command string (cmd) lines  [TUFLIB]
Execute string (cmd) via the shell,
collect the output lines in a row and return this row
If an error occurs, the lines obtained so far
are in the '.data' attribute of the fault item.
If the string contains newlines, the shell may execute
more than one command.

command (cmd) lines  [TUFLIB]
Alias for: command string (cmd) lines
Put the variablle in parenthesis if not found:
stream =: 'uname -a'
row =: command (stream) lines

row of lines from command (cmd)  [TUFLIB] Deprecated.
Alias for: command (cmd) lines

command (cmd) row of lines  [TUFLIB] Deprecated.
Alias for: command (cmd) lines

string (str) quote for shell  [TUFLIB]
Quote shell meta characters by backslash.
The result is not to be enclosed in quotes.

string (str) has character (c)  [TUFLIB]
Test if the character (c) is in string (str).
Obsolete wrapper for: string (str) locate (c)
Intended for optimisation if c is a single character

has string (str) character (c)  [TUFLIB] Deprecated.
Alias for: string (str) has character (c)

is character (c) in string (str)  [TUFLIB] Deprecated.
Alias for: string (str) has character (c)

string (str) count from (start) many of (accept)  [TUFLIB]
Count in string (str) from (start) the characters found in (accept).
If none is found, or (start) is behind the end, then 0 is returned.
Negativ (start) counts from the end (-1 is last).
Zero (start) is an error.

string (str) count from (start) none of (reject)  [TUFLIB]
Count in string (str) from (start) the characters not in (reject).
If none is found, or (start) is behind the end, then 0 is returned.
Negativ (start) counts from the end (-1 is last).
Zero (start) is an error.

string (str) from (start) many of (accept)  [TUFLIB]
Clip in string (str) from (start) the longest part with characters in (accept).
If none is found, or 'start' is behind the end,
the empty string is returned.
Negativ (start) counts from the end (-1 is last).
Zero (start) is an error.

string (str) clip from (start) many of (accept)  [TUFLIB] Deprecated.
Alias for 'string (str) from (start) many of (accept)'

string (src) from (start) none of (reject)  [TUFLIB]
Clip in string (str) from (start) the longest part with characters not in (reject).
If none is found, or 'start' is behind the end,
the empty string is returned.
Negativ (start) counts from the end (-1 is last).
Zero (start) is an error.

string (src) clip from (start) none of (reject)  [TUFLIB] Deprecated.
Alias for: string (src) clip from (start) none of (reject)

string (str) give clips by any of (seps)  [TUFLIB]
Give clips of string (str) separated by any single character in (seps).
If two separators follow directly, an empty string is returned,
also for leading and trailing separators.
If (str) is the empty string, nothing is generated.
See also 'string (str) give clips by many of (seps)'

string (str) give parts cut by any of (seps)  [TUFLIB] Deprecated.
Alias for: string (str) give clips by any (seps)

string (str) give clips by many of (seps)  [TUFLIB]
Give clips of string (str) separated by any combination of characters in (seps).
An empty string is returned only if there is a leading or trailing
separator character.
If (str) is the empty string, nothing is generated.
See also 'string (str) give clips by any of (seps)'

string (str) give parts cut by many of (seps)  [TUFLIB] Deprecated.
Alias for: string (str) give clips by many (seps)

string (src) give clips by (seps)  [TUFLIB]
Give clips of string (str) separated by strings (seps),
which is either a tuple or row of strings, or a single string.
If two separators follow directly, or are head or tail,
an empty string is returned.
If one delimiter is the prefix of another one,
either may be used (not necessarily the longest one).
No delimiter may be the empty string.

string (str) split by any of (seps)  [TUFLIB]
Split string (str) into an row of strings
using any one of the characters in (seps) as separators.
If two separators follow directly, or are leading or trailing,
an empty string is provided (not a void).
The empty string returns a row without elements
Uses 'string str give clips by any of seps' to fill the row.

string (str) split by many of (seps)  [TUFLIB]
Split string (str) into an row of strings
using any combination of the characters in (seps) as separators.
If separators are leading or trailing,
an empty string is provided (not a void).
The empty string returns a row without elements
Uses 'string str give clips by many of seps' to fill the row.

string (str) split by (seps)  [TUFLIB]
Split string (str) into an row of strings
using any one of the strings in the tuple (seps) as separators.
If two separators follow directly,
an empty string is entered (not a void).
The empty string returns a row without elements

string (str) from (pos) has (what)  [TUFLIB]
Tell if string (str) at position (pos) has string (what)
If (what) is a tuple of strings, each is probed,
and the first match is a success.
Wrapper around 'cue = string str from pos length cue.count'

is string (key) in (tgt) from (pos)  [TUFLIB] Deprecated.
Alias for: string (str) from (pos) has (key)

string (str) has head (head)  [TUFLIB]
Check if string (str) starts with the string (head).
(head) may be a tuple of strings; first match is a success
Wrapper for:

has string (str) head (head)  [TUFLIB] Deprecated.
Alias for: string (str) has head (head)

is string (head) head of (str)  [TUFLIB] Deprecated.
Alias for: string (str) has head (head)

is string (head) starting (str)  [TUFLIB] Deprecated.
Alias for: string (str) has head (head)

string (str) has tail (tail)  [TUFLIB]
Check if string (str) ends with the string (tail).
(tail) may be a tuple of strings; any match is a success

is string (tail) tail of (str)  [TUFLIB] Deprecated.
Alias for: has string (tail) tail (str)

is string (tail) ending (str)  [TUFLIB] Deprecated.
Alias for: has string (tail) tail (str)

string (str) as character row  [TUFLIB]
convert a string to a row of (single character) strings

row (row) join values as string  [TUFLIB]
Join cell values of row (row) to a string without separators.
The cell values are in ascending order of the row keys.
As string concatenation converts numbers,
the cell values of the row may be strings or numbers or both.
Void cell values are skipped.

row (row) join values by (sep)  [TUFLIB]
Join cell values of row (row) to a string with separator (sep).
The cell values are in ascending order of the row keys.
As string concatenation converts numbers,
the cell values of the row may be strings or numbers or both.
Void cell values are skipped.

row (row) join keys by (sep)  [TUFLIB]
Join all keys (with nonvoid values) of row (row)
to a string with separator (sep).
The keys are in ascending order.

join (rmt)  [TUFLIB]
Catenate all values of a row, map or tuple with blank as separator.
Values are converted to strings by the string catenation.
See: join () by ()

join (rmt) by (sep)  [TUFLIB]
Catenate all values of a row, map or tuple with (sep) as separator.
Values are converted to strings by the string catenation.
No individual versions for rows, tuples or maps necessary,
as 'give () values' resolves it.

map (this) join keys by (sep)  [TUFLIB] Deprecated.
Join all keys (not values) of map (this) to a string,
separated by (sep), in undefined order
Use: join map map keys by sep

map (this) join values by (sep)  [TUFLIB]
Join all values of map (this) to a string, separated by (sep).
Standard scan is used, thus the order is undefined.

string (str) without leading (chars)  [TUFLIB]
Remove from the beginning of the string (str) all characters
that are in (chars), and return the resulting string.

clip (str) without leading (chars)  [TUFLIB] Deprecated.
Alias for: string (str) without leading (chars)

string (str) without leading whitespace  [TUFLIB]
Remove all leading whitespace from a string.
This is the same as
string str without leading #Whitespace

clip (str) without leading whitespace  [TUFLIB] Deprecated.
Alias for: string (str) without leading whitespace

string (str) without trailing (chars)  [TUFLIB]
Remove from the end of the string (str) all characters
that are in (chars), and return the resulting string.

clip (str) without trailing (chars)  [TUFLIB] Deprecated.
Alias for: string (str) without trailing (chars)

string (str) without trailing whitespace  [TUFLIB]
Remove all trailing whitespace from a string.
This is the same as
string str without trailing #Whitespace

clip (str) without trailing whitespace  [TUFLIB] Deprecated.
Alias for: string (str) without trailing whitespace

string (str) pad left to (len) by (chr)  [TUFLIB]
Pad the start of the string (str) by the character (chr) to the length (len).
If its length already greater than (len), return unchanged.

string (str) pad right to (len) by (chr)  [TUFLIB]
Pad the string (str) at its end by the character (chr) to the length (len).
If its length already greater than (len), return unchanged.

pad left (mixed) to (len) by (chr)  [TUFLIB]
If the parameter (mixed) is a number, convert it to a string, then
pad the start of the string (str) by the character (chr) to the length (len).
If its length already greater than (len), return unchanged.

pad left (mixed) to (len)  [TUFLIB]
If the parameter (mixed) is a number, convert it to a string, then
pad the start of the string (str) by blanks to the length (len).
If its length already greater than (len), return unchanged.

pad right (mixed) to (len) by (chr)  [TUFLIB]
If the parameter (mixed) is a number, convert it to a string, then
pad the start of the string (str) by the character (chr) to the length (len).
If its length already greater than (len), return unchanged.

pad right (mixed) to (len)  [TUFLIB]
If the parameter (mixed) is a number, convert it to a string, then
pad the start of the string (str) by blanks to the length (len).
If its length already greater than (len), return unchanged.

pad left (len) (str)  [TUFLIB]
Alias for: pad left (str) to (len)

pad right (len) (str)  [TUFLIB]
Alias for: pad right (str) to (len)

string (str) quoted  [TUFLIB]
Put a string in Quotes.
Quotes inside are escaped as '&quot;',
and '&quot;' is replaced by '&amp;quot;' before.
Numbers instead of a string are converted to strings.

quote (string)  [TUFLIB]
Alias for: string (string) quoted

string (str) wrap (wrap)  [TUFLIB]
Enclose (str) by (wrap)
If (wrap) is a tuple, returns 'wrap.1 _ string _ wrap.2'
If (wrap) is a string, any occurence of (wrap) inside is doubled.
Use `string () quoted` for escaping by HTML entities.
Numbers are automatically converted to strings and quoted too.

integer (i) as string base (basespec)  [TUFLIB]
Convert integer (i) using arbitrary digit characters from (basespec).
The number of characters in (basespec) determines the base:+
'012356789' is decimal
'0123567' is octal,
'0123456789ABCDEF' is hexadecimal, as is '0123456789abcdef'
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' is base 36
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' is base 62,
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' is base 64
It is recommended to use ASCII 7 bit without controls,
i.e. max. 96 characters, so that the code points are smaller than the basespec.
If duplicate digits are present, the result is undefined.
If the input number is negative, a '-' is prefixed.
If 'basespec' is an integer instead of a string, it must be between 2
and 62 or 64. Unless 64, the above string for basespec 62 is used,
otherwise the altenate string for basespec 64.
If 'basespec' is void, 10 is used.

string (str) as integer base (basespec)  [TUFLIB]
Convert a string (str) to an integer by (basespec)
If (basespec) is an integer between 2 and 62, digits, capital letters
and small letters are used (in this order);
if it is 64, the characters are
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
To have hex digits with small letters, use '0123456789abcdef'
If (basespec) is a string, its characaters are used as digit characters;
the base is the number of characters.
If (basespec) is void, decimal digits are used (base 10).
Integer (basespec) may not be <2, 63 or > 64.
String (basespec) may be of arbitray length;
if there are duplicate characters, the result is undefined.
In the input (str), a leading '-' is used as sign,
so its use as a digit character is undefined.
Blank space or any charcters in the input string that are not in
the base string are not allowed, and a fault item is returned.
Note that in contrast to the function 'string (str) as integer clib (base)':
- 'basespec' may not be zero, and void means decimal only
- prefixing '0x' or a leading zero does not indicate base 16 or 8

string (str) as integer  [TUFLIB]
Integer conversion for strings with decimal digits.
Alias for 'string str as integer base ()'

as integer (str)  [TUFLIB]
Alias for: string (str) as integer
use 'as c integer (str)' if 0x and leading zeros should be possible

integer from string (str)  [TUFLIB] Deprecated.
Alias for: string (str) as integer

integer from (str)  [TUFLIB] Deprecated.
Alias for: string (str) as integer

to integer (str)  [TUFLIB] Deprecated.
Alias for: string (str) as integer

string (str) as integer else (default)  [TUFLIB]
Integer conversion for decimal, octal or hexadecimal strings
(C notation) and supplying a default value if the string
fails to convert;
see 'as c integer (str)'.
Void returns the default (which may be void)

as integer (str) else (default)  [TUFLIB]
Alias for: string (str) as integer else (default)

to integer (str) else (default)  [TUFLIB] Deprecated.
Alias for: string (str) as integer else (default)

integer from string (str) else (default)  [TUFLIB] Deprecated.
Alias for: string (str) as integer else (default)

integer from (str) else (default)  [TUFLIB] Deprecated.
Alias for: string (str) as integer else (default)

string (str) as float else (default)  [TUFLIB]
Floating point conversion for decimal strings
and supplying a default value if the string is not a float
void returns the default (which may be void)

to float (str) else (default)  [TUFLIB] Deprecated.
Floating point conversion for decimal strings
and supplying a default value if the string is not a float
void returns the default (which may be void)

string (str) as integer decimal  [TUFLIB]
Convert 'str' to an integer number for decimal digits only,
by calling 'integer from  str base 10' and ignoring faults;
faulty or empty strings return void.

string (str) case flipped  [TUFLIB]
Flip in string (str) all upper to lower case characters and vice versa.
Call 'set locale' to include non-ASCII characters

string (str) group (gm)  [TUFLIB]
Group decimal digits in (str) by (gm).
The input string is scanned from the end,
and if the fourth decimal digit is encountered in a row,
the group marker (gm) is inserted in between.
This ensures that application to an already grouped string
does not change it.
Also, any string containing digit sequences can be input.
If (gm) is void, nothing is done (not $SYSTEM.groupsep used).

group (str) by (gm)  [TUFLIB]
Alias for 'string () group ()'

group (str)  [TUFLIB]
Short for 'string str group $SYSTEM.groupsep'

string (str) replace character at (pos) by (repl)  [TUFLIB]
Replace in string (str) the character at the position (pos) by (repl).
The new string may be longer or the empty string.

replace character at (pos) in (str) by (repl)  [TUFLIB] Deprecated.
Alias for: 'string (str) replace character at (pos) by (repl)'

string (str) replace at (pos) by (repl)  [TUFLIB]
Replace part of a string (str) by a string (repl)
The replaced part begins at (pos) and has the size of (repl),
i.e. the string length is unchanged.

replace string at (pos) in (str) by (repl)  [TUFLIB] Deprecated.
Alias for: string (str) replace at (pos) by (repl)
Deprecated.

string (str) replace from (from) upto (upto) by (repl)  [TUFLIB]
Replace part of a string (str) by a string (repl)
starting at (from) ending at (upto), both inclusive.

replace string from (from) upto (to) in (str) by (repl)  [TUFLIB] Deprecated.
Alias for:
string (str) replace from (from) upto (upto) by (repl)
Deprecated.

string (str) replace each (cue) by (repl)  [TUFLIB]
Replace in string (str) all occurences of string (cue)
by the string (repl).
The scan continues after the replacement.
If there is no replacement, the original string is returned;
to determine this case, use equality comparison.

replace each (cue) by (repl) in string (target)  [TUFLIB] Deprecated.
Alias for:
string (target) replace each (cue) by (repl)

string (str) replace many (pairs)  [TUFLIB]
Replace in string (str) several parts in one run,
using either a tuple (or row) of (cue, repl) pairs
or a map where the keys are the cue strings.
The first match provided is used (no longest match).
The scan continues after a replacement.
Example:
res =: string "the quick fox jumped" replace many ((the, der), (fox, fuchs))

string (str) replace first (cue) by (repl)  [TUFLIB]
Replace in string (str) the first occurence of string (cue) by (repl)
If there is no replacement, (str) is returned;
to determine this case, use equality comparison.

string (str) without head (head)  [TUFLIB]
If string (str) starts with (head), return the tail.
If there is no replacement, (str) is returned;
to determine this case, use equality comparison.

string (str) encode numeric entities  [TUFLIB]
Replace all numeric HTML entities by the corresponding Unicode character
i.e. '&#nn;' by the code point nn

string (str) as map by pairs  [TUFLIB]
Create a map from key-value pairs in a string, e.g.
map =: to map by pairs 'a=9 b:"x" c=3.0'
The key-value connector character set is many of '=:',
the pairs separated by whitespace.
Intended to create maps from  literals.
Preliminary version, (quoted) values may not yet contain whitespace
or quotes, and no comma or semicolon as separator.

as map string pairs (str)  [TUFLIB]
Alias for: string (str) as map by pairs

apply runtime options (parm)  [TUFLIB] Deprecated.
Apply runtime options in the row (parm)
Returned is a copy of (parm) with the options removed,
or (parm) itself if none of the options were present.
Runtime options are:
--debug
--sysinfo
Required by runtime system and marked deprecated
to discourage normal use.

row (args) parse options values (valopts)  [TUFLIB]
Parse options in argument row 'args'
The argument row is scanned for option entries starting with a minus sign
until a double minus single entry is found.
Options found are added to the result map,
either with the corresponding value, or with '?+' as true.
All processed fields are voided in the supplied row;
thus, scanning the row delivers the remaining arguments.
If a row without voids is desired, use 'shrink row (row)'.
Options may be newer long options, starting with a double minus,
the tag optionally followed by an equals sign and a value.
If old style single letter options with values are used,
a string of characters must be provided in 'valopts' to identify these.
Using new style options is recommended instead.
The caller must handle new and old option aliases.

string (args) parse options (valopts)  [TUFLIB] Deprecated.
Alias for: row (args) parse options values (valopts)

parse options (args) with valopts (valopts)  [TUFLIB] Deprecated.
Alias for: row (args) parse options values (valopts)

system get environment (key)  [TUFLIB]
Get single environment variable (key).

get environment value of (key)  [TUFLIB] Deprecated.
Alias for: system get environment

string (str) parse query  [TUFLIB]
Parse a Query String as produced by HTML Forms
After splitting by '&', each element is checked
for the format 'key=value' and the pair stored in an map.
As positional parameters are rather seldom,
these are collected in an row under .posparms
Conversion of special characters in the %xx format
is done after splitting in fields, keys and values,
just after replacing '+' by ' '

parse query string (str)  [TUFLIB] Deprecated.
Alias for: string (str) parse query

map (this) give keys ascending  [TUFLIB]
Generate the keys of the map 'map' in ascending order
(as opposed to 'give () keys', which lists in undefined order)
The keys should be ASCII strings or numbers.

map (this) give keys descending  [TUFLIB]
Generate the keys of the map (ary) in descending order
(as opposed to 'give () keys', which lists in undefined order)
The keys should be ASCII strings or numbers.

map (this) give keys using (func)  [TUFLIB]
Generate the keys of the map 'ary'
(as opposed to 'give () keys', which lists in undefined order)
using (func) to determine sort order.

map (this) give keys ascending values  [TUFLIB]
Supply the keys of map (this) in ascending order
with respect to the values stored.

map (this) give keys descending values  [TUFLIB]
Supply the keys of map (this) in descending order
with respect to the values stored.

system on exit call (funcref) using (parm)  [TUFLIB]
Register a function (funcref) to be called at normal exit
in reverse order of registering, providing a given parameter.
Once registered, it cannot be removed; but the parameter
can be replaced by using the same reference (funcref),
a void parameter is normal and does not remove the registration.
If more than one parameter is needed, use a tuple;
if none, just specify and ignore.
The returned item reference of the called function is ignored,
unless it is a fault item, which is a fatal error.
There is no mechanism to stop termination.
Doing anything else than cleanup is considered sinful.

system call exit functions  [TUFLIB]
Call the enqueued exit functions, and remove them after the call.
Done by the runtime system at termination;
any other use is discouraged.

math base (base) exp (exponent) by square and multiply  [TUFLIB]
Integer exponentiation via square and multiply.
Base may be integer or rational, exponent non-negative integer.
Same result as base^exponent

is (n) square  [TUFLIB]
Check if argument is a square number
using library square root
speed up by checking (hex) end digit (only 0, 1, 4 or 9)

math gcd (tup)  [TUFLIB]
Greatest Common Divisor of integer numbers
argument is a tuple of positive integers, e.g. a pair
if not a tuple, the argument is returned as-is

math int (e) root (n)  [TUFLIB]
Integer root for integer exponent:
root to the power of exponent is less or equal argument
uses bisection method, i.e. accumulates powers of two
unless e=2, then 'math int sqrt' is used.

random next float  [TUFLIB]
Next floating point random number in the range [0..1[
by ##random next integer / ##$SYSTEM.randmax

TUFPL_crypto.c

string (key) encrypt salt (salt)  [CRYPTO]
Encrypts upto 8 characters (lower 7 bit) of a key string
using salt characters to make decrypting more difficult.
If salt is void, the time of day is used obfuscated.
The result are 2 salt characters, followed by 11 characters encoding 56 bit

encrypt password (key) with salt (salt)  [CRYPTO] Deprecated.
Alias for: string (key) encrypt salt (salt)

random next integer noisy  [CRYPTO]
read true random number from /dev/urandom

string (string) as MD5 chunk  [CRYPTO]
calculate MD5 checksum of a string
the result is a 16 byte chunk

string (string) as MD5 hex  [CRYPTO]
calculate MD5 checksum of a string
the result is a string of 32 hex characters

string (string) as MD5 compact  [CRYPTO]
Calculate MD5 checksum as a compact encoding
that can be used as a word or identifier.
The result is a string of 24 capital and small letters,
starting with a capital letter.
The MD5 sum is split into 16 bit chunks,
each converted to 3 characters using base-52 encoding
starting with a capital letter,
because 2^16 / 52^2 = 24.2

string (string) as SHA1 chunk  [CRYPTO]
calculate SHA1 checksum of a string
the result is a 20 byte chunk

string (string) as SHA1 hex  [CRYPTO]
calculate SHA1 checksum of a string
the result is a string of 40 hex characters

string (string) as SHA1 compact  [CRYPTO]
Calculate SHA1 checksum as a compact encoding
that can be used as a word or identifier.
The result is a string of 30 capital and small letters,
starting with a capital letter.
The SHA1 sum is split into 16 bit chunks,
each converted to 3 characters using base-52 encoding
starting with a capital letter.

TUFPL_hashmap.tuf

new hashmap size (cnt) hash (hashfunc)  [HASHMAP]
Create a new hashmap having (cnt) slots
and using the hash function (hashfunc),
transforming its only argument to an integer,
that is taken modulo (cnt)
Use 1 slot per 1000 upto 10000 expected entries
Defaults when void:
slots: 32
hashfunc: system library function 'string () hash'

new hashmap size (cnt)  [HASHMAP]
Create a new hashmap for strings using the default hash function,
select the number of slots (1 per 100..1000 entries)

new hashmap  [HASHMAP]
Create a new hashmap for strings using all defaults
see: new hashmap size () hash ()

is (x) hashmap  [HASHMAP]
check if hashmap

hashmap (this) at (key) get  [HASHMAP]
Obtain value by (key) from hashmap

hashmap (this) at (key) put (val)  [HASHMAP]
Set (val) as value by (key) into hashmap (this)

hashmap (this) count  [HASHMAP]
return the number of entries in the hashmap (this)
note that this.count is always zero.
(unless (this) is a plain map)

hashmap (this) keys as row  [HASHMAP]
A row of all keys (unsorted)
To have the keys sorted, use
sort (hashmap this keys as row) fast ascending

hashmap (this) key value pairs as row  [HASHMAP]
A row of key, value pairs (unsorted)
To have it sorted by keys, use
sort (hashmap this key value pairs as row) fast ascending

hashmap (this) value key pairs as row  [HASHMAP]
A row of value, key, pairs (unsorted)
To have it sorted by values, use
sort (hashmap this value key pairs as row) fast ascending

hashmap (this) give keys  [HASHMAP]
Supply the keys unordered.
Consider using simply:
kr =: hashmap this keys as row
?# k =: row kr give values
...
Do not use (very inefficient):
?# k =: row (hashmap this keys as row) give values  \ inefficient

hashmap (this) give values  [HASHMAP]
Supply the values unordered.
Consider using simply:
kr =: hashmap this values as row
?# v =: row kr give values
...
Do not use (very inefficient):
?# k =: row (hashmap this values as row) give values  \ inefficient

hashmap (this) give key value pairs ascending  [HASHMAP]
Supply key-value pairs in ascending order of the keys.
Consider using
kr =: sort (hashmap this key value pairs as row) fast ascending
?# kv =: row kr give values
in particular for descending and other sorts
...

hashmap (this) give value key pairs ascending  [HASHMAP]
Supply value-key pairs in ascending order of the values.
Consider using:
kr =: sort (hashmap this value key pairs as row) fast ascending
?# kv =: row kr give values
...
in particular for descending and other sorts

hashmap (this) give keys ascending values  [HASHMAP]
Supply the keys in ascending order of the values,
using sync sort.
Better use
hashmap this give value key pairs ascending

hashmap (this) give keys descending values sync  [HASHMAP]
Supply the keys in descending order of the values,
using sync sort.
Better use
hashmap this give value key pairs descending

hashmap (this) statistics  [HASHMAP]
Return a string with hashmap statistics
TODO: return a map to be joined as in
map (m) key '=' value pairs by ' '

TUFPL_matrix.tuf

new matrix size (dimensions) origin (origin)  [MATRIX]
Create a new matrix with dimensions (dimensions),
which is a tuple of at least two elements, all positive integers,
and whose product does not exceed the available memory.
The tuple is saved at .dimensions and must not be changed.
(origin) is either a tuple with the same number of elements
as (dimension), and gives the lowest index per dimension.
If it is an integer, a corresponding tuple is used,
if void, 1 is used.
As access to a field outside of .origin and .origin+.dimensions
would work without crash, but might expand the matrix unexpectedly,
there is no dynamic resizing as for rows;
the index range is protected by an assertion.
Refrain from changing the fields .dimensions and .origin.

new matrix size (dimensions)  [MATRIX]
Shortcut for 'new matrix size (dimensions) origin (1, 1, ...)

is (x) matrix  [MATRIX]
test if matrix

matrix (m) give keys  [MATRIX]
give the key tuples

matrix (m) print  [MATRIX]
Simple print all elements, one per line