Ajla functions and keywords overview

Name sorted by ASCII Typical usage Short explanation Category Requires "uses ..." before usage
0 0 Constant 0 of type int constant
- -a Changes the sign of the number. Unimportance 1000, associativity left to right. operator
- a-b Subtraction. Unimportance 3000, associativity left to right. operator
-= x-=10; Same as x := x-10; Unimportance 12000, cannot associate. operator
, var x, y := 10, 20; Creates multiple variables and assigns into them. special character
, x, y := y, x Modifies two variables at the same time. The example swaps variables. special character
:= a := b+c; Assignment operator. Puts sum of b and c into a. Doesn't give any result. operator
:= x, y := y, x Modifies two variables at the same time. The example swaps variables. operator
. 3.14 Signalizes a floating point constant (without letter suffix real64). special character
. instance_real_number_real64 .from_bytes(string) Call a method from a class. special character
. list(int).[1,2,3] List pre-filled with integers 1,2,3. You can put different type instead of int. special character
.. mylist[ .. 8] Same as mylist [0..8] special characters
.. mylist[2 .. 8] Shorter list containing members [2] to [7]. special characters
.. mylist[4..] Shorter list containing members [4] [5] ... until the end of the list. special characters
' 'C' Constant of the type char. Contains unicode value 104. constant
" "hi" Constant of the type bytes. Contains bytes 104, 105. No added zero or newline bytes. Encoding is UTF-8. constant
( a*(b+c) Grouping in mathematical expression. Enforces desired precedence. special character
( my_function (argument1, argument2) Function call. If the function doesn't have parameters, you can both use () and without. If function myfn requires arguments and you call just "myfn" not "myfn()", it doesn't run it and just returns a pointer to the function myfn. special character
) a*(b+c) Grouping in mathematical expression. Enforces desired precedence. special character
) my_function (argument1, argument2) Function call. special character
[ [1,2,3] List of integers length 3, filled with 1 2 3 special character
[ [1.0,2,3] List of reals, length 3, filled with 1.0, 2.0, 3.0 special character
[ [a+=1;b+=1;] Turns multiple commands into one command. This one increments both a and b. special character
[ list(int).[1,2,3] List pre-filled with integers 1,2,3. You can put different type instead of int. special character
[ list[0] First element of a list. special character
[ myarray[0,4,7] := 100; Writes 100 into 3-dimensional myarray at coordinates 0,4,7. special character
] [1,2,3] List of integers length 3, filled with 1 2 3 special character
] [1.0,2,3] List of reals, length 3, filled with 1.0, 2.0, 3.0 special character
] [a+=1;b+=1;] Turns multiple commands into one command. This one increments both a and b. special character
] list(int).[1,2,3] List pre-filled with integers 1,2,3. You can put different type instead of int. special character
] list[0] First element of a list. special character
] myarray[0,4,7] := 100; Writes 100 into 3-dimensional myarray at coordinates 0,4,7. special character
{ {comment} Multi-line comment. Can contain line breaks and nested {}'s. special character
} {comment} Multi-line comment. Can contain line breaks and nested {}'s. special character
* 3*a Multiplication. Unimportance 2000, associativity left to right. operator
*= x*=2; Same as x := x*2; Unimportance 12000, cannot associate. operator
/ pi/2 Floating point division. Unimportance 2000, associativity left to right. operator
// //comment Single line comment. Ends at a line break or end of file. special character
/= x/=2; Same as x := x/2; Unimportance 12000, cannot associate. operator
` `hi` Constant of the type string. Contains unicode characters 104, 105. No added zero or newline characters. constant
+ +a Doesn't do anything - returns the same as input. Unimportance 1000, associativity left to right. operator
+ a+b Addition. Unimportance 3000, associativity left to right. operator
+ list1+list2 Appends lists. list2 after list1. Unimportance 3000, associativity left to right. operator
+< my_list +< val Append value val to the end of list my_list. Unimportance 3000, associativity left to right. operator
+<= list+<=element; Same as list := list+<element; Unimportance 12000, cannot associate. operator
+= x+=10; Same as x := x+10; Unimportance 12000, cannot associate. operator
< a<b Tests if left argument is less than the right one. Unimportance 6000, associates left to right. operator
<= a<=b; Same as a := a<b; Unimportance 12000, cannot associate. operator
<= if a<=b Tests if left argument is less or equal than the right one. Unimportance 6000, associates left to right. operator
<== a<==b; Same as a := a<= b; Unimportance 12000, cannot associate. operator
<> a<>b Test for non-equality. Unimportance 6000, associativity left to right. operator
<>= a<>=b; Same as a := a<>b; Unimportance 12000, cannot associate. operator
= a=b Comparison operator. If -0 and +0 are compared, returns true. If both are an exception (NaN is also a type of exception), it returns one of them and it's unspecified which one. If an exception is compared to a non-exception, returns the same exception. Otherwise returns boolean true if equal, otherwise boolean false. Unimportance 6000, associativity left to right. operator
== a==b; Same as a := a=b; Unimportance 12000, cannot associate. operator
==> a<0==>b<0 Logical implication. If a or b are an exception, returns an exception, otherwise false only when a<0 and not b<0, otherwise true. Unimportance 11000, associates left to right. operator
==>= a ==>= b; Same as a := a==>b; Unimportance 12000, cannot associate. operator
> a>b Tests if left argument is greater than the right one. Unimportance 6000, associates left to right. operator
>= a>=b; Same as a := a>b; Unimportance 12000, cannot associate. operator
>= if a>=b Tests if left argument is greater or equal than the right one. Unimportance 6000, associates left to right. operator
>== a>==b; Same as a := a>=b; Unimportance 12000, cannot associate. operator
~cache x=myfunc~cache(x); Cache the results. keyword
~inline x=myfunc~inline(x); Inline the function (i.e. insert it into the caller). keyword
~lazy x=myfunc~lazy(x); Evaluate when needed (like in Haskell). keyword
~normal x=myfunc~normal(x); Default - attempt to parallelize after two timer tick. keyword
~nospec b := a(10~nospec, y); Undoes the specialization which was defined in declaration of function "a". keyword
~save x=myfunc~save(x); Cache the results and save them into ~/.cache/ajla keyword
~spark x=myfunc~spark(x); Parallelize immediately. keyword
~spec b := a(x, 10~spec); This particular call of "a" specializes on 2nd parameter. If we pass a constant as 2nd parameter, a new version of function "a" is created and the constant is inlined into it. keyword
~spec fn a(x~spec y:int):int; Function "a" specializes on parameter x. If we pass a constant as parameter x, a new version of function "a" is created and the constant is inlined into it. keyword
~strict x=myfunc~strict(x); Do not attempt to parallelize. keyword
0. 0. Constant 0 of type 64-bit float constant
abort abort; Terminate the current function with an exception of class ec_sync, type error_abort and code 0. keyword
abs abs(x) (Mathematical) absolute value. Can be used on all simple numeric types but not lists, arrays. function
acos acos(x) Arccosine of x. Doesn't work on type int. Return value is >=0 and <=pi.. function
acosh acosh(x) Hyperbolic arccosine. Doesn't work on type int. function
and a and b Bitwise and. Unimportance 8000, associates left to right. operator
and a<0 and b<0 Logical and. Unimportance 8000, associates left to right. operator
and= a and= b; Same as a := a and b; Unimportance 12000, cannot associate. operator
any any(func1(a), func2(b)) Start evaluating both arguments and waits until any of them becomes evaluated. Returns "false" if the first value is evaluated and "true" if the second value is evaluated. If both of them are evaluated, "false" is returned. Can be used to evaluate something with a 5-second timeout by putting sleep(5000000) as the second argument. function
any_list any_list(mylist) Start evaluating all the values in the list and wait until any of the becomes evaluated. Returns the index of the first value that is evaluated. function
args args[index] In main: program arguments. args[0] contains A and args[1] B if you run "ajla source.ajla A B". function
array array(real,[2,7,52]) 3-dimensional array of reals sized 2×7×52. function returning a type
array_fill array_fill(1,[3,4,5]) 3-dimensional array of ints sized 3×4×5, filles with value 1. function
array_flatten myarray := array_flatten(myarray); Doesn't change the array, just makes sure the internal representation is converted to a simple array (not B-tree which can sometimes happen and which is slower to process). This is for speed optimization before a CPU-demanding code working on the array. function
array_len array_len(myarray) Number of elements (not number of bytes!) in the array. Multiplies all the dimensions together. function
array_read array_read(myarray,[2,4,7]) Same as myarray[2,4,7] except the indices are given as a list. Only reads the array, doesn't write it. function
array_reverse myarray := array_reverse(myarray) Works only on 1-dimensional arrays. Reverses the array so that elements at the beginning end up at the end and vice versa. function
array_sort sorted=array_sort(myarray) Works on 1-dimensional arrays only. Sorts the array contents. Returns also an array. function
array_sparse array_sparse (1,[99,999,9999]) Same as array_fill but compresses repetitions in memory, saving RAM. function
array_to_list mylist := array_to_list(myarray); Converts an array to a list. If we go through the list, first the last array index increments, then the second last etc. function
array_write myarray := array_write(myarray[2,4,7],0); Same as myarray[2,4,7] := 0 except the indices are given as a list. function
asin asin(x) Arcsine of x. Doesn't work on type int. Return value is >=-pi/2 and <=pi/2. function
asinh asinh(x) Hyperbolic arcsine. Doesn't work on type int. function
assert assert(x>=0,"square root of negative"); If x<0, whole Ajla crashes with an assertion failed: square toot of negative and dumps core if core dumping turned on. function
atan atan(x) Arctangent of x. Doesn't work on type int. Return value is >=-pi/2 and <=pi/2. function
atan2 atan2(x,y) Arctangent of x/y which properly handles y=0, signs and infinities. Return value is >=-pi and <=pi. function
atanh atanh(x) Hyperbolic arctangent. Doesn't work on type int. function
atomic_enter w := atomic_enter(w); Increases the atomic count — when the atomic count is non-zero, the thread will not be killed by Ajla. Sometimes e. g. we are printing something to the stdout and in the middle of it a caller function completes a computation whose result is false and our result is being anded with this false and the caller realizes our result is not relevant and we get killed in the middle of the printing and garbled printout results. To prevent this, we do eval atomic_enters, print the whole message and do eval atomic_exit. function io
atomic_exit w := atomic_exit(w); Decreases the atomic count that was increased by the function atomic_enter — when the atomic count is zero, the thread may be killed. When it is already 0 it doesn't do anything. function io
bclone w := bclone(w, src_handle, src_pos, dst_handle, dst_pos, size); If the filesystem supports cloning, clones a byte range from src_handle file handle starting at src_pos to dst_handle starting at dst_pos. If the OS doesn't support it, an exception is returned: class ec_sync, type error_not_supported, aux 0. If OS supports it but filesystem doesn't, returns exception class ec_syscall, type error_system, aux system_error_eopnotsupp. If both support it and an error occurs, exception class ec_syscall, type error_system, aux errno from the manpage ioctl_ficlonerange. w is the world variable. function io
bcontiguous w := bcontiguous(w,h,pos, size); Allocates a contiguous space in the file pointed to by the h (type: handle) at the specified offset pos. Some operating systems do not support file preallocation, for them, this function return success without doing anything. w is the world variable. function io
bdata w,skipped := bdata(w, h, off); From offset off, skips over a hole in the file with handle h. Returns next offset where some data are allocated. Some filesystems do not support holes; for them this function returns off. w is the world variable. function io
bdata_lazy skipped := bdata_lazy(h, off); Works reliably only when data accessed don't change during program execution. From offset off, skips over a hole in the file with handle h. Returns next offset where some data are allocated. Some filesystems do not support holes; for them this function returns off. function io
bhole w, skipped := bhole(w, h, off); From offset off, skips over data in the file which are not a hole. Returns the next offset where there is a hole in the file or the end of file if there are no more holes. Some filesystems do not support holes; for them this function returns the size of the file. w is the world variable. function io
bhole_lazy skipped := bhole_lazy(h, off); Works reliably only when data accessed don't change during program execution. From offset off, skips over data in the file which are not a hole. Returns the next offset where there is a hole in the file or the end of file if there are no more holes. Some filesystems do not support holes; for them this function returns the size of the file. function io
bool var b:bool; false or true. Cannot be converted to other types directly. type
bopen w, resulting_handle := bopen (w, d, f, flags, perms); Do not mix block, read and write modes on one handle! bopen opens a file with filename f (f is type bytes) in a block mode, which means you can read and write at arbitrary offsets in the file. This mode only works for files and block devices. d is a directory handle for the case f is a relative path (see dhandle for details). flags is an "or"-combination of open_flag_*. perms represents the permissions of the file if it is created and uses Unix permission bits: 876 is user's read write execute (rwx), 543 is group's rwx and 210 is others' r rwx. Bits are numbered from the least significant bit. You can also use the constants open_mode_* . In case of a symlink it opens the file pointed to unless it's prohibited by open_flag_no_follow. w is the world variable. If any argument is an exception, returns the leftmost exception. function io
bopen_lazy resulting_handle := bopen (d,f,flags); Works reliably only when data accessed don't change during program execution. Opens a file with filename f (f is type bytes) in a block read-only mode. block mode means we can read from arbitrary offsets. d is a directory handle for the case f is a relative path (see dhandle for details). flags is an "or"-combination of open_flag_*. In case of a symlink it opens the file pointed to unless it's prohibited by open_flag_no_follow. function io
bottom_type var a:bottom_type; Variable a can't hold any value, only exceptions. Used for functions that return only in case of an exception. type
bread w, result := bread(w, h, position, size); Read from file handle h a block of "size" bytes from the specified position "position". If end-of-file is encountered, the function returns less bytes. w is the world variable. result has type bytes. In case of error returns exception class ec_syscall, type error_system, error_errno, error_os2, error_win32. function io
bread_lazy result := bread(h, position, size); Works reliably only when data accessed don't change during program execution. Read from file handle h a block of "size" bytes from the specified position "position". If end-of-file is encountered, the function returns less bytes. result has type bytes. In case of error returns exception class ec_syscall, type error_system, error_errno, error_os2, error_win32. function io
brev brev x Reverse bits in number x. Unimportance 4000, associativity left to right. operator
bsetsize w := bsetsize(w, h, size); Truncates a file to the specified size or extends it with zeroes. w is the world variable. h is file handle. size is in bytes. function io
bsf bsf x Finds the lowest (rightmost) set bit in x. Counts from right from 0. Unimportance 4000, associativity left to right. operator
bsize w,size := bsize(w, h); Must not mix with read and write otherwise file position behaves unpredictably. Returns the size of the file pointed to by file handle h. w is the world variable. function io
bsize_lazy size := bsize(h); Works reliably only when data accessed don't change during program execution. Returns the size of the file pointed to by file handle h. function io
bsr bsr x Finds the highest (leftmost) set bit in x. Counts from right from 0. Unimportance 4000, associativity left to right. operator
bswap bswap x Reverse bytes in number x without reversing bits inside bytes. Unimportance 4000, associativity left to right. operator
bt x bt y Test whether y-th bit in x is set. Counted from right, beginning from 0. Unimportance 4000, associativity left to right. operator
btc x btc y Invert y-th bit in x. Counted from right, beginning from 0. Unimportance 4000, associativity left to right. operator
btc= x btc= y; Same as x := x btc y; Unimportance 12000, cannot associate. operator
btr x btr y Clear y-th bit in x to 0. Counted from right, beginning from 0. Unimportance 4000, associativity left to right. operator
btr= x btr=y; Same as x := x btr y; Unimportance 12000, cannot associate. operator
bts x bts y Set y-th bit in x to 1. Counted from right, beginning from 0. Unimportance 4000, associativity left to right. operator
bts= x bts=y; Same as x := x bts y; Unimportance 12000, cannot associate. operator
bwrite w := bwrite(w, h, pos, s); Write bytes from s (type bytes - list of bytes) to the specified position pos in file referrd to by handle h. If we write beyond file end, the file is extended with zeroes. In case of error returns exception class ec_syscall, type error_system, error_errno, error_os2, error_win32. w is the world variable. function io
byte var a:byte; The type byte is the same type as uint8; type
bytes var b:bytes; An alias for list(byte). type
cast cast(real16, 12345) Changes to given type. Rounding is towards zero for floating point to int and towards the nearest one for floating point to floating point. Result will be 12344, because real16 cannot store 12345. function
cbrt cbrt(x) Cube root (3rd root) of x. Doesn't work on int type. function
ceil ceil(x) Rounds always upwards (towards +inf). cail(-3.3)=-3. function
char var a:char; char is the same type int32; type
chmod w := chmod(w, d, f, m); w is the world variable. f is a file path (type: bytes). d is directory handle (see dhandle for details) for the case the file path is relative. Sets permissions according to m which are Unix permission bits: 876 is user's read write execute (rwx), 543 is group's rwx and 210 is others' r rwx. function io
chown w := chown(w, d, f, user, group); Changes the numeric owner user and numeric group numbers. function io
clip pix := clip(pix,0,255); Clips pix to the range 0-255. function
const const million := 1000000; Like a variable, but can't be modified. keyword
cos cos(x) Cosine. Returns the same data type as input. Doesn't work on int type. function
cosh cosh(x) Hyperbolic cosine. Doesn't work on type int. function
debug eval debug("point F"); Prints DEBUG MESSAGE: point F to stderr. Without eval doesn't work. function
decimal var d:decimal(9) Same as fixed_point(10,9). type
div h := m div 60; Result of integer division, also known as quotient. Unimportance 2000, associativity left to right. operator
div= j div=2; Same as j := j div 2; Unimportance 12000, cannot associate. operator
dmonitor w, w_later := dmonitor(w,d); w_later := write(w_later,h[1],"Directory changed!"+nl); w := write(w,h[1],"Normal execution"); w := join(w,w_later); Similar to fork, but returns w immediately and w_saved when the directory changes, and join in this example waits until the directory changes. Supported monitoring events differ between operating systems. On systems which don't support it e.g. OS/2, old Linux, returns exception class ec_sync type error_not_supported aux 0. It is recommended to use w and store w_saved for later. w is the world variable. function io
dnone h := dnone(w); Returns an invalid directory handle. It is useful if you want to open a file and you know that the file path is absolute — in this case, you can pass dnone() to ropen, wopen, bopen or dopen. w is the world variable. function io
dopen w,h := dopen(w, d, p, flags) : (world, dhandle); Opens a directory with path p (type: bytes) that is relative to an existing directory d (type: dhandle). If d contains dnone, p must be absolute path. flags are of type int and the only allowed flags are 0 and open_flag_no_follow. If p doesn't exists, exception class ec_syscall, type error_system, aux system_error_enoent. w is the world variable. function io
dopen_lazy h := dopen(d, f, flags) : (world, dhandle); Works reliably only when data accessed don't change during program execution. Opens a directory with path p (type: bytes) that is relative to an existing directory d (type: dhandle). if d contains dnone, p must be absolute path. flags are of type int and the only allowed flags are 0 and open_flag_no_follow. If p doesn't exists, exception class ec_syscall, type error_system, aux system_error_enoent. function io
dpath w,path := dpath(w, d); Returns the absolute path of the directory d (type: dhandle). Note that we cannot return a path for file handles, because there may be multiple names referring to a single inode. w is the world variable. function io
dpath_lazy path := dpath(d); Works reliably only when data accessed don't change during program execution. Returns the path that the directory d points to. d has type dhandle. Note that we cannot return a path for file handles, because there may be multiple names referring to a single inode. function io
dread w,list_of_directory_entries := dread(w, d : dhandle); Reads the directory d and returns the list of directory entries. d has type dhandle. w is the world variable. function io
dread_lazy list_of_directory_entries := dread(d : dhandle); Works reliably only when data accessed don't change during program execution. Reads the directory d and returns the list of directory entries. d has type dhandle. function io
droot my_dhandle := droot(w) Returns a handle to the root directory. On Windows or OS/2, it returns a handle to the alphabetically first non-floppy disk (e.g. C:\). On Termux and Cygwin it returns handle to "/". Can return an error if ran out of resources. w is the world variable. function io
dstatfs w,r := dstatfs(w, d, flags); Returns information about the filesystem on which directory d (type: dhandle) is. Request multiple pieces of information in flags by oring together statfs_flag_* constants. Returns r an array of integer results which contains only the results requested in this order: statfs_flag_bsize, statfs_flag_frsize, statfs_flag_frtotal, statfs_flag_frfree, statfs_flag_fravail, statfs_flag_intotal, statfs_flag_infree, statfs_flag_inavail, statfs_flag_fsid, statfs_flag_flags, statfs_flag_namelen. w is the world variable. function io
ec_async var a := ec_async; An integer constant meaning that an exception happened due to conditions not related to the program, e.g. memory allocation failure. constant
ec_exit var a := ec_exit; An integer constant meaning that the exception holds the return value the program should return when it exists. constant
ec_sync var a := ec_sync; An integer constant meaning that an exception happened due to execution of the program, e.g. invalid numeric calculation or index out of array/list size. constant
ec_syscall var a := ec_syscall; An integer constant meaning that an exception happened because some syscall failed. constant
else if a<0 then[b-=1;]else[b+=1;] If a is less than zero, decrements b, otherwise increments b keyword
empty empty(int) Creates an empty list of integers. function
error_errno var a := error_errno; A constant of type int which means that the exception aux has a meaning of errno value. constant
error_exit var a := error_exit; A constant of type int which means that the exception aux is the the return value that should be returned from the current process. constant
error_gai var a := error_gai; A constant of type int which means that the exception aux has a meaning of getaddrinfo return value. constant
error_h_errno var a := error_h_errno; A constant of type int which means that the exception aux has a meaning of h_errno error number. constant
error_os2 var a := error_os2; A constant of type int which means that the exception aux has a meaning of OS/2 error number. constant
error_os2_socket var a := error_os2_socket; A constant of type int which means that the exception aux has a meaning of OS/2 socket error number. constant
error_subprocess var a := error_subprocess; A constant of type int which means that the exception aux is the subprocess exit number, if the code is negative, it is the signal number that terminated the subprocess. constant
error_system var a := error_system; A constant of type int which means that the exception aux has a meaning of system_error_* values. constant
error_win32 var a := error_win32; A constant of type int which means that the exception aux has a meaning of a Windows error number. constant
eval eval debug("blabla"); Evaluates the debug) and discards the return value, but pretends the return value of the function in which eval is depends on the return value of the debug, so that the functional language doesn't optimize the debug out. keyword
exception_aux exception_aux x Returns the auxilliary value of the exception in variable x as in int. If exception type is error_system, this is system_error_eperm (1) through system_error_ehwpoison (131) defined in newlib/ex_codes.ajla. If exception type is error_errno, error_os2, error_os2_socket or error_win32, exception_aux x is directly the operating system error code. operator
exception_class exception_class x Returns class of the exception in variable x as type int: 0 is ec_none, 1 ec_sync, 2 ec_async, 3 ec_syscall, 4 ec_library, 5 ec_exit defined in newlib/ex_codes.ajla. operator
exception_payload exception_payload x Returns the raw string attached to the exception in variable x. operator
exception_stack exception_stack x Returns the stack trace attached to the exception in variable x. operator
exception_string exception_string x Returns the exception string of an exception in variable x. operator
exception_type exception_type x Returns the type of the exception in variable x as an int. Numeric codes defined in newlib/ex_codes.ajla as error_unknown_error (1) to error_user3 (35). In order to be able to test error codes portably (on Linux, Unix, OS/2 and Windows), Ajla tries to translate Windows and OS/2 error codes to system_error_* aux code. If the translation is successful, the exception type is error_system (22) and exception_aux x contains system error code system_error_* . If the translation is unsuccessful, exception type error_errno, error_os2, error_os2_socket or error_win32 is returned and and aux is directly the operating system error code. operator
exit w := exit(w,10); w is the world variable. If w contains an exception, returns the same exception. Otherwise returns exception class ec_exit, type error_exit, aux 10. The program after the exit statement runs, but doesn't produce any I/O. function io
exit_msg w := exit_msg(w,10,"message"); w is the world variable. If w contains an exception, returns the same exception. Otherwise returns exception class ec_exit, type error_exit, aux 10 and the message will be stored in the exception. The program after the exit statement runs, but doesn't produce any I/O and at the end prints the message to stderr. function io
exp exp(x) Raises e (the base of natural logarithm, 2.7182818...) to x. Doesn't work on type int. function
exp10 exp10(x) Raises 10 to x. Doesn't work on type int. function
exp2 exp2(x) Raises 2 to x. Doesn't work on type int. function
exponent exponent(x) Returns exponent so that mantissa(x)*2^exponent is x. Doesn't work on type int. function
false var b:bool := false; False value for boolean purpose. keyword
fdatasync w := fdatasync(w,h); w is the world variable. h is a file handle (type: handle). It synchronized only that file onto the disk. The file's mtime is not modified by fdatasync and is not synchronized onto the disk. In case of I/O error returns exception class ec_sync type error_system, aux system_error_eio. function io
ffssync w := ffssync(w,h); w is the world variable. h is a file handle (type: handle). It synchronized onto the disk the whole filesystem on which the file is. The file's mtime is not modified by ffssync and is synchronized onto the disk. In case of I/O error returns exception class ec_sync type error_system, aux system_error_eio. If the OS doesn't support this function, sync of all filesystems is performed instead. On some operating systems, ffssync may return before the data is written. function io
fill fill('a',10); Creates a list with 10 elements all equal to 'a'. function
fixed_point var f:fixed_point(10,9) Base 10 fixed point with 9 decimal digits. Doesn't overflow - automatically stretches. Supports negatives. type
floating var f:floating(10,30) Floating point with 10 exponent bits and 30 mantissa bits. type
floor floor(number) Rounds a number always down, towards -inf. floor(-3.3)=-4. function
fmod fmod(dividend,divisor) Floating point remainder. If inputs have the same sign, result is nonnegative, otherwise nonpositive function
fn fn mymul(a b:real64):real64[return a*b;] Makes a function named mymul taking two 64-bit floats, returning their product as a 64-bit float. keyword
for for i in [10,20,30,40] do b+=i; Iterates over 10, 20, 30, 40. keyword
for for i := 0 to 10 do b*=2; Iterates from 0 to 9, doubling b 10 times. keyword
fork var w1, w2 := fork(w); Creates threads. Splits the w variable from main into w1 and w2 which have to be used instead of w inside the threads. Then join has to be used to join the threads. function
format format("% men % women",[3,4]); Replaces every % by a number from the list (converts numbers to text). The list can be floating points as well. function
fract fract(number) Fractional part. fract(3.1)=0.1. fract (-3.1)=-0.1. fract +inf=0, fract(-inf)=-0. Doesn't work on int type. function
fstat w,r := fstat(w, h, flags); Returns numeric pieces of information about the file in h (type: handle) into r (type: list of int64) according to "flags", which are an ored combination of stat_flag_devmajor, stat_flag_devminor, stat_flag_inode, stat_flag_type, stat_flag_mode, stat_flag_nlink, stat_flag_uid, stat_flag_gid, stat_flag_rdevmajor, stat_flag_rdevminor, stat_flag_size, stat_flag_optimaliosize, stat_flag_allocated, stat_flag_atime, stat_flag_mtime, stat_flag_ctime. This is the order in which the values are returned. Values not requested are not present in the list. w is the world variable. function io
fstat_lazy r := fstat_lazy(h, flags); Works reliably only when data accessed don't change during program execution. Returns numeric pieces of information about the file in h (type: handle) into r (type: list of int64) according to "flags", which are an ored combination of stat_flag_devmajor, stat_flag_devminor, stat_flag_inode, stat_flag_type, stat_flag_mode, stat_flag_nlink, stat_flag_uid, stat_flag_gid, stat_flag_rdevmajor, stat_flag_rdevminor, stat_flag_size, stat_flag_optimaliosize, stat_flag_allocated, stat_flag_atime, stat_flag_mtime, stat_flag_ctime. This is the order in which the values are returned. Values not requested are not present in the list. function io
fstatfs w, r := fstatfs(w, h, flags); In r (type: list(int64)) returns information about the filesystem on which file h (type: handle) is. Request multiple pieces of information in flags by oring together statfs_flag_* constants. The resultant list r contains only the results requested in this order: statfs_flag_bsize, statfs_flag_frsize, statfs_flag_frtotal, statfs_flag_frfree, statfs_flag_fravail, statfs_flag_intotal, statfs_flag_infree, statfs_flag_inavail, statfs_flag_fsid, statfs_flag_flags, statfs_flag_namelen. w is the world variable. function io
fsync w is the world variable. h is a file handle (type: handle). It synchronized only that file onto the disk. The file's mtime is not modified by fdatasync and is synchronized onto the disk. In case of I/O error returns exception class ec_sync type error_system, aux system_error_eio. function io
get_host_name w,hostname := get_host_name(w); Gets the host name of the system. w is the world variable. function io
get_monotonic_time w,time := get_monotonic_time( w); Returns 64-bit time in microseconds which is monotonic (never jumps back). Zero point is OS-dependent. Granularity is system-dependent. w is the world variable. function io
get_real_time w,time := get_real_time(w); Returns 64-bit time in microseconds. Granularity is system-dependent. w is the world variable. Jan 1 1970 0:00:00 UTC corresponds to 0 microseconds and they grow 1 000 000 microseconds a second except when a leap second (23:59:59,23:59:60,00:00:00) is inserted, the microseconds jump back 1 second at the moment :59 flips into :60. If a leap second is left out (23:59:58,00:00:00), microseconds jump 1 second forward at the moment :58 flips into :00. They also jump when system time is adjusted. function io
get_tai_time w,time := get_tai_time(w); Returns 64-bit time in microseconds. Granularity is system-dependent. w is the world variable. Jan 1 1970 0:00:00 TAI (Temps Atomique International - International Atomic Time) corresponds to 0 microseconds and they always grow 1 000 000 microseconds a second. They jump when system time is adjusted. function io
h 3h Suffix indicating real16 floating point constant. special character
H 3H Suffix indicating real16 floating point constant. special character
h write(h[1],"Hello, world!"+nl); Prints "Hello, world!" onto stdout. h[2] is stderr, h[0] standard input. variable
heap var h:heap(int); A binary heap that can quickly insert an element or extract the lowest element. type
identity x := identity(x); Doesn't do anything. identity is a function that simply returns the input. type
if if a<0 then[b-=1;] If a is less than zero, decrements b. keyword
if if a<0 then[b-=1;]else[b+=1;] If a is less than zero, decrements b, otherwise increments b keyword
implicit fn main(implicit w : world Automatically add the variable to the function calls where it fits and automatically return it if no return is written. keyword
implicit implicit fn If you pass less arguments to a function than what was specified in the function header, the compiler will attempt to infer the remaining arguments. The "implicit" keyword makes this function a candidate for inferring. keyword
infinite infinite(10) Infinite list filled with values 10. function
infinite infinite(355) Returns an infinitely long list whose all elements are initialized to value 355. function
infinite_repeat infinite_repeat([1,2,3]) Infinite list filled with repeating values 1 2 3 1 2 3 etc. function
infinite_uninitialized infinite_uninitialized() Returns an infinitely long list whose all elements are uninitialized - that is an exception of class ec_sync, type error_array_entry_not_initialized and with aux set to 0. keyword
infinite_uninitialized infinite_uninitialized(int) Infinite list of ints with all members being exceptions. May be useful for making associative arrays. function
inherit_division_ring_real_number drcls := inherit_division_ring_real_number(cls); Converts a real number type class into a division ring type class. function
inherit_eq_array eqcls := inherit_eq_array(cls); Converts an array type class into an eq class. function
inherit_eq_list eqcls := inherit_eq_list(cls); Convert a list type class into an eq class. function
inherit_eq_ord eqcls := inherit_eq_ord(cls); Converts an ord type class into an eq class. function
inherit_eq_tuple2 eqcls := inherit_eq_tuple2(cls); Converts a 2-tuple (pair) class into an eq class. function
inherit_eq_tuple3 eqcls := inherit_eq_tuple3(cls); Converts a 3-tuple (triple) class into an eq class. function
inherit_eq_tuple4 eqcls := inherit_eq_tuple4(cls); Converts a 4-tuple (quadruple) class into an eq class. function
inherit_eq_tuple5 eqcls := inherit_eq_tuple5(cls); Converts a 5-tuple (quintuple) class into an eq class. function
inherit_group_unit_ring gcls := inherit_group_unit_ring(cls); Converts a unit ring class into a group class. function
inherit_integer_number_fixed_integer_number ficls := inherit_integer_number_fixed_integer_number (cls); Converts a fixed integer number type class into integer number type class. function
inherit_logical_integer_number lcls := inherit_logical_integer_number (cls); Converts an integer number type class into logical type class. function
inherit_magma_monoid macls := inherit_magma_monoid(cls); Converts a modoid type class into a magma type class. function
inherit_monoid_group mocls := inherit_monoid_group(cls); Converts a group type class into a monoid type class. function
inherit_ord_array ocls := inherit_ord_array(cls); Converts an array type class into an ord type class. function
inherit_ord_integer_number icls := inherit_ord_integer_number (cls); Converts an integer number type class into an ord type class. function
inherit_ord_list ocls := inherit_ord_list(cls); Converts a list type class into an ord type class. function
inherit_ord_real_number ocls := inherit_ord_real_number(cls); Converts a real number type class into an ord type class. function
inherit_ord_tuple2 ocls := inherit_ord_tuple2(cls); Converts a tuple2 (pair) type class into an ord type class. function
inherit_ord_tuple3 ocls := inherit_ord_tuple3(cls); Converts a tuple3 (triple) type class into an ord type class. function
inherit_ord_tuple4 ocls := inherit_ord_tuple4(cls); Converts a typle4 (quadruple) type class into an ord type class. function
inherit_ord_tuple5 ocls := inherit_ord_tuple5(cls); Converts a tuple5 (quintuple) type class into an ord type class. function
inherit_show_integer_number scls := inherit_show_integer_number (cls); Converts an integer number type class into a show type class. function
inherit_show_real_number scls := inherit_show_real_number (cls); Converts a real number type class into a show type class. function
inherit_unit_ring_division_ring urcls := inherit_unit_ring_division_ring (cls); Converts a division ring type class into a unit ring type class. function
inherit_unit_ring_integer_number urcls := inherit_unit_ring_integer_number (cls); Converts an integer number type class into a unit ring type class. function
instance_fixed_integer_number_sint instance_fixed_integer_number_sint (10) A function which returns an instance of the type class fixed_integer_number, which is a record with function pointers filled out to point to the appropriate functions for the type sint(10). function
instance_fixed_integer_number_sint128 instance_fixed_integer_number_sint128() A function which returns an instance of the type class fixed_integer_number, which is a record with function pointers filled out to point to the appropriate functions for the type sint128. function
instance_fixed_integer_number_sint16 instance_fixed_integer_number_sint16() A function which returns an instance of the type class fixed_integer_number, which is a record with function pointers filled out to point to the appropriate functions for the type sint16. function
instance_fixed_integer_number_sint32 instance_fixed_integer_number_sint32() A function which returns an instance of the type class fixed_integer_number, which is a record with function pointers filled out to point to the appropriate functions for the type sint32. function
instance_fixed_integer_number_sint64 instance_fixed_integer_number_sint64() A function which returns an instance of the type class fixed_integer_number, which is a record with function pointers filled out to point to the appropriate functions for the type sint64. function
instance_fixed_integer_number_sint8 instance_fixed_integer_number_sint8() A function which returns an instance of the type class fixed_integer_number, which is a record with function pointers filled out to point to the appropriate functions for the type sint8. function
instance_fixed_integer_number_uint instance_fixed_integer_number_uint(11) A function which returns an instance of the type class fixed_integer_number, which is a record with function pointers filled out to point to the appropriate functions for the type uint(11). function
instance_fixed_integer_number_uint128 instance_fixed_integer_number_uint128() A function which returns an instance of the type class fixed_integer_number, which is a record with function pointers filled out to point to the appropriate functions for the type uint128. function
instance_fixed_integer_number_uint16 instance_fixed_integer_number_uint16() A function which returns an instance of the type class fixed_integer_number, which is a record with function pointers filled out to point to the appropriate functions for the type uint16. function
instance_fixed_integer_number_uint32 instance_fixed_integer_number_uint32() A function which returns an instance of the type class fixed_integer_number, which is a record with function pointers filled out to point to the appropriate functions for the type uint32. function
instance_fixed_integer_number_uint64 instance_fixed_integer_number_uint64() A function which returns an instance of the type class fixed_integer_number, which is a record with function pointers filled out to point to the appropriate functions for the type uint64. function
instance_fixed_integer_number_uint8 instance_fixed_integer_number_uint8() A function which returns an instance of the type class fixed_integer_number, which is a record with function pointers filled out to point to the appropriate functions for the type uint8. function
instance_functor_array instance_functor_array ([256,256,3]) A function which returns an instance of the type class functor, which is a record with function pointers filled out to point to the appropriate functions for the type array. function
instance_functor_list instance_functor_list() A function which returns an instance of the type class functor, which is a record with function pointers filled out to point to the appropriate functions for the type list. function
instance_logical_bool instance_logical_bool() A function which returns an instance of the type class logical, which is a record with function pointers filled out to point to the appropriate functions for the type bool. function
instance_monoid_list instance_monoid_list(real) A function which returns an instance of the type class monoid, which is a record with function pointers filled out to point to the appropriate functions for the type list of real numbers. You can change the word real for other data types that can form lists. function
instance_monoid_nat instance_monoid_nat() A function which returns an instance of the type class monoid, which is a record with function pointers filled out to point to the appropriate functions for the type nat. function
instance_monoid_nat128 instance_monoid_nat128() A function which returns an instance of the type class monoid, which is a record with function pointers filled out to point to the appropriate functions for the type nat128. function
instance_monoid_nat16 instance_monoid_nat16() A function which returns an instance of the type class monoid, which is a record with function pointers filled out to point to the appropriate functions for the type nat16. function
instance_monoid_nat32 instance_monoid_nat32() A function which returns an instance of the type class monoid, which is a record with function pointers filled out to point to the appropriate functions for the type nat32. function
instance_monoid_nat64 instance_monoid_nat64() A function which returns an instance of the type class monoid, which is a record with function pointers filled out to point to the appropriate functions for the type nat64. function
instance_monoid_nat8 instance_monoid_nat8() A function which returns an instance of the type class monoid, which is a record with function pointers filled out to point to the appropriate functions for the type nat8. function
instance_number_int instance_number_int() A function which returns an instance of the type class number, which is a record with function pointers filled out to point to the appropriate functions for the type int. function
instance_number_int128 instance_number_int128() A function which returns an instance of the type class number, which is a record with function pointers filled out to point to the appropriate functions for the type int128. function
instance_number_int16 instance_number_int16() A function which returns an instance of the type class number, which is a record with function pointers filled out to point to the appropriate functions for the type int16. function
instance_number_int32 instance_number_int32() A function which returns an instance of the type class number, which is a record with function pointers filled out to point to the appropriate functions for the type int32. function
instance_number_int64 instance_number_int64() A function which returns an instance of the type class number, which is a record with function pointers filled out to point to the appropriate functions for the type int64. function
instance_number_int8 instance_number_int8() A function which returns an instance of the type class number, which is a record with function pointers filled out to point to the appropriate functions for the type int8. function
instance_ord_bool instance_ord_bool() A function which returns an instance of the type class ord, which is a record with function pointers filled out to point to the appropriate functions for the type bool. function
instance_ord_nat instance_ord_nat() A function which returns an instance of the type class ord, which is a record with function pointers filled out to point to the appropriate functions for the type nat. function
instance_ord_nat128 instance_ord_nat128() A function which returns an instance of the type class ord, which is a record with function pointers filled out to point to the appropriate functions for the type nat128. function
instance_ord_nat16 instance_ord_nat16() A function which returns an instance of the type class ord, which is a record with function pointers filled out to point to the appropriate functions for the type nat16. function
instance_ord_nat32 instance_ord_nat32() A function which returns an instance of the type class ord, which is a record with function pointers filled out to point to the appropriate functions for the type nat32. function
instance_ord_nat64 instance_ord_nat64() A function which returns an instance of the type class ord, which is a record with function pointers filled out to point to the appropriate functions for the type nat64. function
instance_ord_nat8 instance_ord_nat8() A function which returns an instance of the type class ord, which is a record with function pointers filled out to point to the appropriate functions for the type nat8. function
instance_real_number_fixed_point instance_real_number_fixed_point (10,4) A function which returns an instance of the type class real_number, which is a record with function pointers filled out to point to the appropriate functions for the type fixed_point(10,4). (base 10 numbers with 4 fractional digits). function
instance_real_number_floating instance_real_number_floating (4,3) A function which returns an instance of the type class real_number, which is a record with function pointers filled out to point to the appropriate functions for the type floating(4,3). (Floating point with 4 exponent and 3 mantissa bits). function
instance_real_number_rational instance_real_number_rational () A function which returns an instance of the type class real_number, which is a record with function pointers filled out to point to the appropriate functions for the type rational. function
instance_real_number_real128 instance_real_number_real128 () A function which returns an instance of the type class real_number, which is a record with function pointers filled out to point to the appropriate functions for the type real128. function
instance_real_number_real128 .from_bytes instance_real_number_real128 .from_bytes(string) Converts a string into 128-bit real number. -1e-3 is supported. inf and -inf is supported, case sensitive. function
instance_real_number_real128 .from_bytes_base instance_real_number_real128 .from_bytes_base (string, base) Converts a string in given base into 128-bit real number. -1e-1 is supported. inf and -inf are supported, case sensitive. function
instance_real_number_real128 .pi instance_real_number_real128 .pi Pi as a 128-bit float. constant
instance_real_number_real16 instance_real_number_real16() A function which returns an instance of the type class real_number, which is a record with function pointers filled out to point to the appropriate functions for the type real16. function
instance_real_number_real16 .from_bytes instance_real_number_real16 .from_bytes(string) Converts a string into 16-bit real number. -1e-3 is supported. inf and -inf is supported, case sensitive. function
instance_real_number_real16 .from_bytes_base instance_real_number_real16 .from_bytes_base(string, base) Converts a string in given base into 16-bit real number. -1e-1 is supported. inf and -inf are supported, case sensitive. function
instance_real_number_real16 .pi instance_real_number_real16 .pi Pi as a 16-bit float. constant
instance_real_number_real32 instance_real_number_real32() A function which returns an instance of the type class real_number, which is a record with function pointers filled out to point to the appropriate functions for the type real32. function
instance_real_number_real32 .from_bytes instance_real_number_real32 .from_bytes(string) Converts a string into 32-bit real number. -1e-3 is supported. inf and -inf is supported, case sensitive. function
instance_real_number_real32 .from_bytes_base instance_real_number_real32 .from_bytes_base(string, base) Converts a string in given base into 32-bit real number. -1e-1 is supported. inf and -inf are supported, case sensitive. function
instance_real_number_real32 .pi instance_real_number_real32 .pi Pi as a 32-bit float. constant
instance_real_number_real64 instance_real_number_real64() A function which returns an instance of the type class real_number, which is a record with function pointers filled out to point to the appropriate functions for the type real64. function
instance_real_number_real64 .from_bytes instance_real_number_real64 .from_bytes(string) Converts a string into 64-bit real number. -1e-3 is supported. inf and -inf is supported, case sensitive. function
instance_real_number_real64 .from_bytes_base instance_real_number_real64 .from_bytes_base(string, base) Converts a string in given base into 64-bit real number. -1e-1 is supported. inf and -inf are supported, case sensitive. function
instance_real_number_real64 .pi instance_real_number_real64 .pi Pi as a 64-bit float. constant
instance_real_number_real80 instance_real_number_real80() A function which returns an instance of the type class real_number, which is a record with function pointers filled out to point to the appropriate functions for the type real80. function
instance_real_number_real80 .from_bytes instance_real_number_real80 .from_bytes(string) Converts a string into 80-bit real number. -1e-3 is supported. inf and -inf is supported, case sensitive. function
instance_real_number_real80 .from_bytes_base instance_real_number_real80 .from_bytes_base(string, base) Converts a string in given base into 80-bit real number. -1e-1 is supported. inf and -inf are supported, case sensitive. function
instance_real_number_real80 .pi instance_real_number_real80 .pi Pi as a 80-bit float. constant
int var a:int; Integer data type. -2^2147483648...2^2147483648-1 type
int_to_native int_to_native(native.integer,3); Writes the integer into memory as C type "int" with the length and endianness Ajla was compiled for and then puts the content of the memory into a byte string (type bytes). The type native.integer can be replaced with: native.short, native.unsigned_short, native.unsigned_integer, native.long, native.unsigned_long, native.long_long, native.unsigned_long_long, native.n_int16, native.n_uint16, native.n_int32, native.n_uint32, native.n_int64, native.n_uint64. integer means int, n_int16 means int16_t, n_uint16 means uint16_t etc. function
int128 var a: int128; Integer data type. -2^2147483648...2^2147483648-1 type
int16 var a: int16; Integer data type. -2^2147483648...2^2147483648-1 type
int32 var a: int32; Integer data type. -2^2147483648...2^2147483648-1 type
int64 var a: int64; Integer data type. -2^2147483648...2^2147483648-1 type
int8 var a: int8; Integer data type. -2^2147483648...2^2147483648-1 type
integer_number_to_integer_number a := integer_number_to_integer_number(b); Converts from an integer of one type to integer of a different type (or even the same type but then it's not necessary). function
integer_number_to_real_number a := integer_number_to_real_number (b); Converts from integer b to real number a. function
internal abort internal("internal inconsistency"); The whole program crashes with this message. You can also use eval instead of abort. If you don't use neither eval nor abort, it will be considered irrelevant and optimized out and will do nothing. function
ipower ipower(2,8) Raises 2 to the power of 8, returning 256. Works only on integer types. function
is_exception is_exception x If x contains an exception or NaN, returns boolean true, otherwise boolean false. Unimportance 5000, associativity left to right. operator
is_infinity is_infinity x If x is +inf or -inf, returns boolean true, if x is an exception, returns the exception, otherwise returns boolean false. Unimportance 5000, associativity left to right. operator
is_negative is_negative x If x<0, returns boolean true, if x is an exception, returns the exception, otherwise returns boolean false. Unimportance 5000, associativity left to right. operator
is_ready is_ready(a) Ajla has automatic parallelization that means in the past we assigned something into a and it might not have been computed yet, instead replaced by so called thunk which is a note what should be computed. is_ready returns true if the value is not this thunk. function
is_uninitialized is_uninitialized(x) If x is an exception of class ec_sync and type error_array_entry_not_initialized then it returns true, otherwise if it's an exception it returns that exception, otherwise it returns false. function
is_uninitialized_record is_uninitialized_record(x) If x is an exception of class ec_sync and type error_record_field_not_initialized then it returns true, otherwise if it's an exception it returns that exception, otherwise it returns false. If we create a record and don't fill out some entries, this kind of exception is filled in into them. function
join w := join(w1, w2); At the end of threads created by fork we have to join them using join and put the result back into the world variable w and return it from main. If we don't return w from main or don't feed w1 or w2 into a join, these variables will become irrelevant and things they depend on will be optimized out. function
keep keep unusedvar; Prevents the optimizer from removing unused variable unusedvar. When called on a thunk it doesn't try to evaluate the thunk like eval. I don't understand what keep is good for and also what happens when keep is called on something which is neither an unused variable nor a thunk. keyword
l 3l Suffix indicating real80 floating point constant. special character
L 3L Suffix indicating real80 floating point constant. special character
lambda list_filter(l, lambda(x : int) [ return not x bt 0; ]) "lambda" is a special function name to make an anonymous function, which can be assigned into a variable whose type is function (basically a function pointer). function
lchown w := lchown(w, d, f, user, group); Changes the numeric owner user and numeric group numbers but doesn't dereference symlinks. function io
ldexp ldexp(x,y) Floating point x*power(2,y). function
len len(mylist) Length of a list. If list is endless, freezes and hogs RAM! function
len_at_least len_at_least(mylist,9) A way to test whether list has at least 9 members which doesn't freeze and hog RAM on infinite lists. function
len_greater_than len_greater_than(mylist,9) A way to test whether list has at least 10 members which doesn't freeze and hog RAM on infinite lists. function
list list(int).[1,2,3] List containing integers 1,2,3. You can put different type instead of int. function returning a type
list var a:list(int); Variable has a type list of integers. function returning a type
list_begins_with list_begins_with("begins", "be"); Returns true. Tests whether the 2nd string is a prefix of the 1st. If the 2nd string is empty, always returns true. function
list_break list_break("2025-12-23",'-'); returns ["2025","12","31"]. The separator can be only a single character (including NUL 0). Two or more repeating separators in the middle of the string return one or more empty entries. One or more separators at the beginning return one or more empty entries. One or more separators at the end of the list returns zero or more empty entries. Empty input returns empty output, input consisting of only 1 or more separators returns 1 or more empty entries. function
list_break_to_lines lines := list_break_to_lines(read_lazy(h[0])); Like list_break(,cast(byte,10)) except that also a sequence of bytes 13,10 is considerd one separator (within this sequence the byte 10 is not considered an additional separator) and 13 that is not followed by a 10 is not considered a separator character, but a part of the string text. Separators 10 and 13,10 can be freely mixed. function
list_break_whitespace list_break_whitespace(" ex am ple ") returns ["ex","am","ple"]. Finds runs of whitespace characters (space, tab, CR, LF) and puts substrings between these runs to the output. Also removes runs at the beginning and end of the input string. function
list_consumer for i := list_consumer("abcdefgh") Iterates i in the for cycle from 'a' to 'h'. If the input is empty, doesn't do anything. If used on endless list, doesn't consume any additional RAM. The use with "for" is the only use that makes sense. iterator
list_ends_with list_ends_with("ends","ds"); returns true because "ends" ends with "ds". Tests whether the 2nd string is a suffix of the 1st. If the 2nd string is empty, always true. function
list_filter l := list_filter(l, test_function); Calls test_function onto each element of the list and gives the function the value of the element and if function returns true, the element is retained, otherwise is left out. function
list_filter_idx l := list_filter_idx(l, test_function); Calls test_function(index,value), onto each element, where index is the index of the element (beginning with 0) and value the value of the element and if the function returns true, the element is retained, otherwise is left out. function
list_flatten l := list_flatten(l); Doesn't change the list but converts it into a flat structure (no trees) which is faster to operate on but takes more RAM in case of sparse lists. function
list_fold list_fold (1, [10,15,20], lambda (x y:int) : int[return x*y]); Appends the first number 1 to the beginning of the list 10 15 20 and then goes from left and runs the function provided (lambda(...]) on each pair and replaces the pair with the result etc. until only 1 number is left. That number is returned. function
list_fold_monoid list_fold_monoid ([3,7,9]); For a list of numbers it adds them together (3+7+9). In general it understand the type of the list elements as a monoid and performs the monoid-related operation on them all together. function
list_iterator for i := list_iterator("abcdefgh") Iterates i in the for cycle from 0 to 7. If the input is empty, doesn't do anything. If used on infinite lists, consumes RAM linear to the sequence number of element being evaluated. The use with "for" is the only use that makes sense. iterator
list_iterator_reverse for i := list_iterator("abcdefgh") Iterates i in the for cycle from 7 to 0. If the input is empty, doesn't do anything. If used on infinite lists, consumes RAM linear to the sequence number of element being evaluated. The use with "for" is the only use that makes sense. iterator
list_join list_join(m, nl) Concatenates all list elements while sticking nl strings in between them. function
list_join_lines list_join_lines("line 1","line 2", "line 3"); Appends a nl (newline) to each member and concatenates them all together. Even the last line will obtain a newline at the end. function
list_left_pad list_left_pad(string, 6, '0') Pads a string to length of 6 bytes by adding digits 0 to the left. If it's already too long, it doesn't chop off. function
list_map_fold list_map_fold(0,[1,3,7,9], lambda(x:int):int[return x*x;], lambda(x y:int):int[return x+ y;]) Performs so called map-reduce. Applies the first function (map) on each element and then reduces elements together using the 2nd function (reduce). The reduce function must be associative (must not depend on the way elements are bracketed together in a long list) function
list_map_fold_monoid list_map_fold_monoid ([1,3,7,9], lambda(x:int):int[return x*x;]) Like list_map_fold except you don't specify the 1st parameter (zero element) and 3rd (reduce function) because they are taken by default from the monoid. function
list_repeat llist := list_repeat(slist, 10); Creates long list llist by 10 times repeating short list slist. function
list_replace_substring list_replace_substring (haystack, needle, replacement) Takes 3 list parameters. Searches list needle in list haystack and if not found, returns haystack unchanged. If found, replaces needle with replacement and continues search after the end of the replacement - the replacement is not scanned for needle anymore. After all the replacements are done, returns the haystack with replacements. Haystack may be infinitely long. If needle is empty and replacement nonempty, returns an infinite list of repeating replacement and haystack is ignored. If both needle and replacement are empty, returns haystack unmodified. function
list_reverse rlist := list_reverse(mylist); Reverses a list so that the sequence of the elements is reversed but the elements themselves are intact. function
list_right_pad list_right_pad(string, 6, ' ') Pads a string to length of 6 bytes by adding spaces to the right. If it's already too long, it doesn't chop off. function
list_search list_search(haystack,needle) Searches for element needle in list haystack. If found, returns the index of first occurence, otherwise -1. On endless lists it either finds an answer or ends up in endless loop. haystack and needle can be a list of any type of class eq (both the same), even lists of lists. function
list_search_backwards list_search_backwards (haystack, needle) Like list_search but starts from the end towards beginning. With endless lists it freezes and consumes ever increasing RAM. function
list_search_backwards_fn list_search_backwards_fn (haystack, lambda(x:byte):bool[return x>=127;]) Like list_search_fn but from the end towards the beginning. With endless lists it freezes and consumes ever increasing RAM. function
list_search_fn list_search_fn (haystack, lambda(x:byte):bool[return x>=127;]) Like list_search but instead of a value it gets a function (the lambda in this case) that tests a value and if it returns true, it's considered found. function
list_search_substring list_search_substring(haystack, needle) Searches substring needle in string haystack and returns index to the first character of needle or -1 if not found. Haystack and needle are lists of any type of class eq (both the same), even a list of lists. function
list_sort sorted := list_sort(mylist); Sorts the list in ascending order (begins with small values ends with large) function
list_sort_unique sorted := list_sort(mylist); Sorts the list in ascending order (begins with small values ends with large) and leaves only 1 item from each repetition. function
list_string_break_to_lines lines := list_break_to_lines (mystring); like list_break_to_lines, but instead of type bytes (list of bytes) it works on type string (list of chars). function
list_to_array list_to_array([2,3,4],mylist) Fills an array from the list: first fills in [0,0,0], then [0,0,1] until [0,0,3], then [0,1,0]... unti; [1,2,3]. If the list is too short or long, it returns an exception class ec_sync, type error_invalid_operation, aux 0. function
log log(x) Natural logarithm (base 2.7182818...). Doesn't work on type int. function
log10 log10(x) Base 10 logarithm. Doesn't work on type int. function
log2 log2(x) Base 2 logarithm. Doesn't work on type int. function
lstat w,r := lstat(w, d, f, flags); Returns numeric pieces of information about the file in f (type: bytes) relative to the directory d (type: dhandle) into r (type: list of int64) according to "flags", which are an ored combination of stat_flag_devmajor, stat_flag_devminor, stat_flag_inode, stat_flag_type, stat_flag_mode, stat_flag_nlink, stat_flag_uid, stat_flag_gid, stat_flag_rdevmajor, stat_flag_rdevminor, stat_flag_size, stat_flag_optimaliosize, stat_flag_allocated, stat_flag_atime, stat_flag_mtime, stat_flag_ctime. This is the order in which the values are returned. Values not requested are not present in the list. If the f is a symlink, returns information about the symlink itself. If the f is an absolute path, d is unused except if it contains an exception. w is the world variable. function io
lstat_lazy r := lstat_lazy(d, f, flags); Works reliably only when data accessed don't change during program execution. Returns numeric pieces of information about the file in f (type: bytes) relative to the directory d (type: dhandle) into r (type: list of int64) according to "flags", which are an ored combination of stat_flag_devmajor, stat_flag_devminor, stat_flag_inode, stat_flag_type, stat_flag_mode, stat_flag_nlink, stat_flag_uid, stat_flag_gid, stat_flag_rdevmajor, stat_flag_rdevminor, stat_flag_size, stat_flag_optimaliosize, stat_flag_allocated, stat_flag_atime, stat_flag_mtime, stat_flag_ctime. This is the order in which the values are returned. Values not requested are not present in the list. If the f is a symlink, returns information about the symlink itself. If the f is an absolute path, d is unused except if it contains an exception. function io
lutime w := lutime(w,d,f, atime, mtime) : world; Changes atime and mtime of file with filename f (type: bytes) in 64-bit microseconds and ctime to current time. w is the world variable. If the path ends with a symlink, it changes the times for the symlink, not the symlink target. If f is relative, directory d (type: dhandle) is used. Jan 1 1970 0:00:00 UTC corresponds to 0 microseconds and they grow 1 000 000 microseconds a second except when a leap second (23:59:59,23:59:60,00:00:00) is inserted, the microseconds jump back 1 second at the moment :59 flips into :60. If a leap second is left out (23:59:58,00:00:00), microseconds jump 1 second forward at the moment :58 flips into :00. They also jump when system time is adjusted. function io
main fn main(w : world, d : dhandle, h : list(handle), args : list(bytes), env : treemap(bytes, bytes), prereq len(h) >= 3) : world Every program has to have one. When the program is started, it enters this function and when the function exists, the program exits. function
mantissa mantissa(x) Returns floating point mantissa of x. Result is -inf, >-1 and <=-0.5, 0, >=0.5 and <1, inf or NaN. Doesn't work on type int. function
map map(mylist, ntos); Runs a given function (ntos) on each element of the list separately and makes a list from the results. function
max max(15,12) Returns 15. Selects the bigger from the two numbers. It works on class ord, so that it works even on lists, arrays and booleans. Doesn't work on classes, types, exceptions, and other types which don't define the class ord. function
maybe var x:maybe(int) Variable a can hold either an integer, nothing, or an exception. type
maybe x := maybe(int).n; How to put nothing into variable x of type maybe(int). type
min min(15,12) Returns 12. Selects the smaller from the two numbers. It works on class ord, so that it works even on lists, arrays and booleans. Doesn't work on classes, types, exceptions, and other types which don't define the class ord. function
mkblockdev w := mkblockdev(w, d, f, perms major, minor); Makes block device with path f (type: bytes). If f is relative, directory d (type: dhandle) is used as a base. major minor and numbers of the block device. perms are permissions: bits 11-10-9-8-7-6-5-4-3-2-1-0 UGSrwxrwxrwx (SUID, SGID, sticky, rwx for user, rwx for group, rwx for others, rwx means read write execute). is w is the world variable. function io
mkchardev w := mkchardev(w, d, f, perms major, minor); Makes character device with path f (type: bytes). If f is relative, directory d (type: dhandle) is used as a base. major minor and numbers of the block device. perms are permissions: bits 11-10-9-8-7-6-5-4-3-2-1-0 UGSrwxrwxrwx (SUID, SGID, sticky, rwx for user, rwx for group, rwx for others, rwx means read write execute). is w is the world variable. function io
mkdir w := mkdir(w, d, p, perms); Makes directory with path p (type: bytes). If p is relative, uses d (type: dhandle) as base directory. perms (type: int) are permissions: bits 11-10-9-8-7-6-5-4-3-2-1-0 UGSrwxrwxrwx (SUID, SGID, sticky, rwx for user, rwx for group, rwx for others, rwx means read write execute). In case of error returns an exception class ec_syscall. It follows symlinks. function io
mklink w := mklink(w, newdir, new, olddir, old); Make a hardlink named new (type: bytes) sharing content and attributes (inode) with existing file old (type: bytes). if new is relative, newdir is used as a based. if old is relative, olddir is used as a base. w is the world variable. function io
mkmaybe mkmaybe("hello"); Creates a value of the type maybe(bytes), which actually holds some value (doesn't hold nothing) and the value is "hello". function
mkpipe w := mkpipe(w, d, p, perms); Makes a name pipe with path p (type: bytes). If p is relative, directory d (type: dhandle) is used as base. perms (type: int) are permissions: bits 11-10-9-8-7-6-5-4-3-2-1-0 UGSrwxrwxrwx (SUID, SGID, sticky, rwx for user, rwx for group, rwx for others, rwx means read write execute). In case of error returns exception class ec_syscall. w is the world variable. function io
mksocket w := mksocket(w, d, f, mode); Makes a Unix domain socket with path p (type: bytes). If p is relative, directory d (type: dhandle) is used as base. perms (type: int) are permissions: bits 11-10-9-8-7-6-5-4-3-2-1-0 UGSrwxrwxrwx (SUID, SGID, sticky, rwx for user, rwx for group, rwx for others, rwx means read write execute). In case of error returns exception class ec_syscall. w is the world variable. function io
mksymlink w := mksymlink(w, d, p, t); Make a symlink with path p (type: bytes) whose content (target) is the string t (type: bytes). If p is relative, directory d (type: dhandle) is used as base. w is the world variable. function io
mktuple2 mktuple2(4,2) Creates a value of the type tuple2, holding values 4 and 2. function
mktuple3 mktuple3(5,6,6) Creates a value of the type tuple3, holding values 5, 6, 6. function
mktuple4 mktuple4(2,6,5,6) Creates a value of the type tuple4, holding values 2, 6, 5, 6. function
mktuple5 mktuple5(3,7,8,13,3) Creates a value of the type tuple4, holding values 3, 7, 8, 13, 3. function
mod m := m mod 60; Remainder after integer division. Unimportance 2000, associativity left to right. operator
mod= j mod=2; Same as j := j mod 2; Unimportance 12000, cannot associate. operator
mount_points w, m := mount_points(w); In m returns the list of mount points (type: list(bytes)). w is the world variable. On OS/2 and Windows it returns a list of active disks, including ":\". function io
nat var a:nat; A nonnegative integer, doesn't overflow. Nonnegativity is tested only with --verify switch. type
nat128 var a: nat128; A nonnegative integer, doesn't overflow. Nonnegativity is tested only with --verify switch. type
nat16 var a: nat16; A nonnegative integer, doesn't overflow. Nonnegativity is tested only with --verify switch. type
nat32 var a: nat32; A nonnegative integer, doesn't overflow. Nonnegativity is tested only with --verify switch. type
nat64 var a: nat64; A nonnegative integer, doesn't overflow. Nonnegativity is tested only with --verify switch. type
nat8 var a: nat8; A nonnegative integer, doesn't overflow. Nonnegativity is tested only with --verify switch. type
native_to_int native_to_int(native.integer,[0,0,0,3]); Puts the bytes into memory and interprets them as C type "int" (variable length and endianness depending on the CPU and OS it was compiled for). If the list of bytes (type bytes) is too short or too long, returns an exception of class ec_sync, type error_invalid_operation, and aux 0. native.integer can be replaced with: native.short, native.unsigned_short, native.unsigned_integer, native.long, native.unsigned_long, native.long_long, native.unsigned_long_long, native.n_int16, native.n_uint16, native.n_int32, native.n_uint32, native.n_int64, native.n_uint64. integer means int, n_int16 means int16_t, n_uint16 means uint16_t etc. function
never eval never(int); Like sleep(inf): hangs up, but doesn't consume CPU. Pretends it's trying to calculate a value of the type int. This freezing propagates through all ordinary computation with exception of: unused values, any and any_list (where all arguments must block at the same time for any or any_list to actually block), and with false, or with true, implication (==>) with first argument false or second argument true and binary operators where one argument is an exception (including a NaN). function
next_number next_number(x) For the given type returns next bigger representable number (towards +inf). function
nl write(h[1],"Hello, world!"+nl); On DOS, Windows outside Cygwin, OS/2 a string containing CR LF. On other systems, incl. Cygwin, a string containing LF. constant
not not a Bitwise negation. Unimportance 7000, associates left to right. operator
not not a=3 Logical negation. Unimportance 7000, associates left to right. operator
ntos ntos(number) Converts an integer, float, rational into a string. Notation 1e3 is not supported. function
ntos_base ntos_base_precision(number,base) Converts number to string. Base is numeral system base. It must be an integer so it cannot have a fractional part. Uppercase letters are used when printing numbers with bases larger than 10. function
ntos_base_precision ntos_base_precision(number,base,digits) Converts number to string. Base is numeral system base. Digits is number of digits for the fractional part. Uppercase letters are used when printing numbers with bases larger than 10. function
open_flag_append wopen(..., ..., ..., open_flag_append Opening for appending. Used by wopen only. ropen and bopen return an error on this. constant io
open_flag_create wopen(..., ..., ..., open_flag_create Creating a file if it doesn't exist. Used by wopen and bopen. ropen returns an error on this. constant io
open_flag_must_create bopen(..., ..., ..., open_flag_must_create Must be combined with open_flag_create. If the file exists, returns an exception class ec_syscall, type error_system, aux is system_error_eexist. constant io
open_flag_no_follow ropen(..., ..., ..., open_flag_no_follow Works the same as O_NOFOLLOW flag in man 2 open: prohibits opening files with last component a symlink. Error ELOOP is returned in such case as a exception class ec_syscall, type error_system, aux system_error_eloop. constant io
open_flag_read bopen(..., ..., ..., open_flag_read Opening for reading. Used only by bopen. wopen and ropen return an error on this. constant io
open_flag_write bopen(..., ..., ..., open_flag_write Opening for writing. Used only by bopen. wopen and ropen return an error on this. constant io
open_mode_default bopen(...,open_mode_default) Unix mode rw-rw-rw- 0666 (Ajla doesn't have octal constants, but it's same like on Unix, see bopen or wopen for details) is bitwise anded with inverted umask (man 2 umask) and the resulting mode is used. constant io
open_mode_read_all_users bopen(...,open_mode_read_all_users) Unix mode rw-r--r-- 0644 (Ajla doesn't have octal constants, but it's same like on Unix, see bopen or wopen for details) is bitwise anded with inverted umask (man 2 umask) and the resulting mode is used. constant io
open_mode_ro_all_users bopen(...,open_mode_ro_all_users) Unix mode r--r--r-- 0444 (Ajla doesn't have octal constants, but it's same like on Unix, see bopen or wopen for details) is bitwise anded with inverted umask (man 2 umask) and the resulting mode is used. constant io
open_mode_ro_current_user bopen(...,open_mode_ro_current_user) Unix mode r-------- 0400 (Ajla doesn't have octal constants, but it's same like on Unix, see bopen or wopen for details) is bitwise anded with inverted umask (man 2 umask) and the resulting mode is used. constant io
open_mode_rw_current_user bopen(...,open_mode_rw_current_user) Unix mode rw------- 0600 (Ajla doesn't have octal constants, but it's same like on Unix, see bopen or wopen for details) is bitwise anded with inverted umask (man 2 umask) and the resulting mode is used. constant io
operator operator hm 2000(n:real,m:real):real[return n*m/(n+m);] Makes an infix operator hm which calculates harmonic mean. keyword
operator operator postfix ++ 1000(n:int):int[return n+1;] Makes a postfix operator ++ that increments without assigning back. keyword
or a or b Bitwise or. Unimportance 10000, associates left to right. operator
or a<0 or b<0 Logical or. Unimportance 10000, associates left to right. operator
or= a or=b; Same as a := a or b; Unimportance 12000, cannot associate. operator
path_append result := path_append(pd, pf); Appends filesystem path component pf to pd. If pd doesn't end with a path separator, path separator is inserted. function io
path_canonical w,result := path_canonical(w, d, f); Takes the path to the directory d (type: dhandle), makes sure it ends with the path separator, and appends the filename f (type: bytes). w is the world variable. function io
path_compare is_same := path_compare(a, b); a and b are of type bytes. On Windows, OS/2, DOS, '/' and '\' are considered the same character and comparison is case-insensitive. On other OSes it's a simple string comparison. "/etc/passwd", "/etc//passwd", "/etc/./passwd" and "/etc/../etc/passwd" are all considered different. function io
path_config w, dh := path_config(w, env, appname); Returns directory dh (type: dhandle) where the application can create config files. On Linux it's according to XDG, on Windows it uses the APPDATA environment variable. env (type: treemap(bytes, bytes)) are the environment variables from main or modified if the user wants it. w is the world variable. appname is the application name (type: bytes) i.e. the name of the directory. function io
path_contract result := path_contract(p); Removes from p (type: bytes) superfluous path separators and superfluous components with "." and "..". Result has type bytes. function io
path_expand_home result := path_expand_home(home, p); If home is maybe(bytes).n, returns p. Otherwise if p begins with a tilde (~), replaces the tilde with home.j, p has type bytes. function io
path_get_cwd w,retval := path_get_cwd(w, d, env); If the environment variable PWD from the environment variables in env (type: treemap(bytes, bytes)) points to the same directory as d (type: dhandle), returns the content of PWD after performing path_contract. retval has type bytes. Otherwise returns the path of directory d (type: dhandle). w is the world variable. function io
path_is_absolute is_absolute := path_is_absolute(p); Tests whether given path on a filesystem is absolute (as opposed to relative). p has type bytes. function io
path_is_dir_separator is_dir_separator := path_is_dir_separator(b); Tests whether a single byte b is the directory separator: '\' and '/' on DOS, OS/2, Windows, and Cygwin. On other systems only forward slash '/'. function io
path_is_root result := path_is_root(p); result has type bool. Performs path_contract on p (type: bytes). If the result is "/", returns true. On Windows, OS/2, Cygwin and DOS if the result is "A:/" or "A:\" ... "Z:/" or "Z:\" also returns true. Otherwise returns false. function io
path_is_separator is_separator := path_is_separator(b) ; Tests whether a single byte b (type: byte) is the separator: backslash \, slash / and colon : on DOS, OS/2, Windows, and Cygwin. On other systems only forward slash '/'. function io
path_join result := path_join(pd, pf); result has type bytes. if (pf: type bytes) is absolute, returns path_contract(pf). Otherwise joins pd (type: bytes) and pf together and applies path_contract to the results. function io
path_mkdir w := path_mkdir(w, d, p , perm); w is the world variable. p is understood as a path of a directory. Creates all directories in the path p which don't exist yet. If f is relative, d (type: dhandle) is the base directory. perms (type: int) are permissions: bits 11-10-9-8-7-6-5-4-3-2-1-0 UGSrwxrwxrwx (SUID, SGID, sticky, rwx for user, rwx for group, rwx for others, rwx means read write execute). function io
path_shortcut_home result := path_shortcut_home(home , p); Both p and result have type bytes. If home (type: maybe(bytes)) is maybe(bytes).n, returns p. Otherwise if p begins with home.j, replaces it in p with a tilde (~). function io
path_to_dir_file dir,file := path_to_dir_file(p); Splits path p (type: bytes) into directory component dir (type: bytes) and file (type: bytes). dir will not with path separator (e.g. /) except if dir is a root directory (e.g. "C:\", "A:\", "/"). function io
path_write_atomic w := path_write_atomic(w, d, f, content); Atomically creates or overwrites file with path f (type: bytes) with given content (type: bytes). If f is relative, uses d (type: dhandle) as the base directory. w is the world variable. function io
path_xdg w,xdg_dir := path_xdg(w, env, xdg_env, deflt, appname); w is the world variable. Returns directory according to the XDG specification in xdg_dir (type: dhandle). If the variable xdg_env(type: bytes) exists in environment variables env (type: treemap(bytes, bytes)), returns the content of the environment variable with appname (type: bytes) appended. Otherwise if on Windows and the environment variable APPDATA exists in env, returns the cotent of the APPDATA variable with appname appended. Otherwise if the variable HOME is set, appends deflt (type; bytes) and appname to it and returns it. Otherwise it takes the directory where the executable of Ajla compiler is and appends appname to it. function io
pipe w, hread, hwrite := pipe(w); Creates an unnamed pipe (there is no filesystem path associated with an unnamed pipe) and returns two handles. The first handle is used for reading from the pipe and the second handle is used for writing to the pipe. function io
popcnt popcnt x Counts the set bits in number x. Unimportance 4000, associates left to right. operator
postfix operator postfix ++ 1000(n:int):int[return n+1;] Signalizes that the operator being defined is postfix. keyword
power power(x,y) Floating point x raised to power y. function
prefix operator prefix ++ 1000(n:int):int[return n+1;] Signalizes that the operator being defined is prefix. keyword
prev_number prev_number(x) For the given type returns next smaller representable number (towards -inf) function
private private fn Makes a declaration of a function, constant or type only usable in the unit where it appears. It will not be visible in other units. keyword
q 3q Suffix indicating real128 floating point constant. special character
Q 3Q Suffix indicating real128 floating point constant. special character
range for i in range(0, 10, 2) It ill iterate i and incrementing it by two, over values 0, 2, 4, 6, 8. Number 10 is the first value that is excluded. "range" is not useful in any other context than the for statement. iterator
rational var r:rational; Rational number. Neither denominator nor numberator overflow. +inf and -inf is supported (1/0 and -1/0). type
read w,result := read(w, h, size); Read "size" number of bytes from the file handle h, which has type handle. If end of file is hit, it returns less bytes. If not enough bytes is available (in case of a pipe or a character device), the function will sleep until the specified number of bytes is read. w is the world variable. In case of error returns exception class ec_syscall, type error_system, error_errno, error_os2, error_os2_socket, error_win32. function io
read_full w,result := read_full(w, h); Reads all the bytes from the file handle h (type: handle) until EOF (end of file). May sleep on pipes that haven't hit an EOF yet. If an error occurs, in both w and result returns an exception with class ec_syscall. w is the world variable. function io
read_lazy result := read_lazy(h); Works reliably only when data accessed don't change during program execution. Returns an incomplete list. The data from the handle h (type: handle) is read as the user accesses the list. If the handle blocks, accessing the list may block too. If an error occurs, the returned result contains exception class ec_syscall. function io
read_partial w, result := read_partial(w, h, size); Read "size" number of bytes from the file handle h (type: handle). If not enough bytes are available, the function returns less bytes. If no bytes are available, the function sleeps until at least one byte is returned. w is the world variable. If an error occurs, returns exception in w. function io
readlink w,pis := readlink(w, d : dhandle, sp); w is the world variable. Reads the path inside the symlink pis (type: bytes) from symlink path p (type: bytes). If sp is relative, directory d (type: dhandle) is used as the base. function io
readlink_lazy pis := readlink_lazy(d, sp); Works reliably only when data accessed don't change during program execution. Reads the path inside the symlink pis (type: bytes) from symlink path p (type: bytes). If sp is relative, directory d (type: dhandle) is used as the base. function io
real var a:real; Real is the same data type as real64; type
real_number_to_integer_number b := real_number_to_integer_number (a); Converts from a real number a to integer number b. function
real_number_to_real_number b := real_number_to_real_number(a); Converts from a real number of one type to a real number of another type (can be even the same type but then it's useless). function
real128 var a:real128; 128-bit IEEE 754 floating point. type
real16 var a:real16; 16-bit IEEE 754 floating point. type
real32 var a:real32; 32-bit IEEE 754 floating point. type
real64 var a:real64; 64-bit IEEE 754 floating point. type
real80 var a:real80; 80-bit IEEE 754 floating point or if the machine doesn't support 80 but supports 128, 128-bit. type
record record person[name:string;age:int;] Declares a record. keyword
recover_world w := recover_world(w, old_w); Recovers the current world w from old world old_w which the caller saved before an I/O exception occured, so that I/O starts working again. function io
register_dependence w := register_dependence(w, d : dhandle, p); Regarding ~save. It saves a fingerprint of the file p (type: bytes) and when the Ajla program ends, it stores the fingerprint into the cache file for ~save. When the program is started next time, it verifies the fingerprint and if it doesn't match, invalidates the whole ~save cache. changes w is the world variable. function io
rename w := rename(w, newbd, new, oldbd, old); w is the world variable. Renames or moves within the same filesystem a file, directory or symlink with path old (type: bytes) to path new (type: bytes). If it should be moved to a different filesystem, return an exception. If old is relative, uses oldbd (type: dhandle) as base directory. If new is relative, uses newbd (type: dhandle) as base directory. If old is a symlink, it renames the symlink itself, not its target. function io
report_memory_largest eval report_memory_largest ("point A"); If you enable --debug=leak, report the summary of allocated memory in the whole program (not just the running thread), for example "DEBUG MESSAGE: allocated memory at point A: 689030 / 4054 = 169". If you don't enable --debug=leak, it just prints "WARNING: memory list not available, use --debug=leak." function
report_memory_most eval report_memory_most ("point B"); If you enable --debug=leak, report locations where most memory was allocated in the whole program (not just the running thread), for example this "DEBUG MESSAGE: pcode.c:3298 284314 / 234 = 1215" means that there is 284314 bytes in 234 blocks allocated at pcode.c:3298. If you don't enable --debug=leak, it just prints "WARNING: memory list not available, use --debug=leak." function
report_memory_summary eval report_memory_summary ("point C"); If you enable --debug=leak, report the largest allocated blocks in the whole program (not just the running thread), for example this "DEBUG MESSAGE: pcode.c:3298 35378" means that there is a block of 35378 bytes being allocated at pcode.c:3298. If you don't enable --debug=leak, it just prints "WARNING: memory list not available, use --debug=leak." function
return return a*b; Returns from a function. Returns the product of variables a and b. Subsequent commands until end of function will be ignored. keyword
rmdir w := rmdir(w, bd : dhandle, dp : bytes); w is the world variable. Removes directory whose path is dp (type: bytes). If dp is relative, uses bd (type: dhandle) as base directory. If called on a file or symlink instead of a directory (even on a symlink pointing to a directory), returns an exception. function io
rol cast(uint8,3) rol 2 Takes 3 and rotates it left by 2 bits, yielding 12. Bits that fall out on the left enter from the right again. Unimportance 4000, associativity left to right. Doesn't work on automatically expanding integer types. operator
rol= x rol=2; Same as x := x rol 2; Unimportance 12000, cannot associate. operator
ropen w,myhandle := ropen(w : world, d : dhandle, f : bytes, flags : int) ; This function will open a file in read mode and return a handle to the file. w is the world token, d has type dhandle and is the base directory that is used for file name lookup. f is the file name, f has type bytes. flags can be only 0 or flag open_flag_no_follow. function io
ropen_lazy myhandle := ropen_lazy(d : dhandle, f : bytes, flags : int) ; Works reliably only when data accessed don't change during program execution. This function will open a file in read mode and return a handle to the file. d has type dhandle and is the base directory that is used for file name lookup. f is the file name, f has type bytes. flags can be only 0 or flag open_flag_no_follow. function io
ror cast(uint8,8) ror 2 Takes 8 and rotates it right by 2 bits, yielding 2. Bits that fall out on the right enter from the left again. Unimportance 4000, associativity left to right. Doesn't work on automatically expanding integer types. operator
ror= x ror=2; Same as x := x ror 2; Unimportance 12000, cannot associate. operator
round round(x) Rounds to nearest integer. Inputs which are exactly between two integers are rounded away from zero. function
s 3s Suffix indicating real32 floating point constant. special character
S 3S Suffix indicating real32 floating point constant. special character
sandbox_world w := sandbox_world(w); w is the world variable. Returns a world in which file I/O is possible only on already existing open handles. This is meant as a protection against untrustworthy Ajla code. function io
select select(b, x, y) If b is false, returns x, otherwise y. function
sgn sgn(x) If x is -0, 0 or +0, returns +0 or 0. If x is a positive number or +inf returns 1, if negative or -inf -1. In case of NaN or an exception returns the input. Returns the same type as the input. The input type must be and can be any number type. function
shl 1 shl 16 Bit shift left, in this case returns 65536. Unimportance 4000, associativity left to right. operator
shl= x shl=8; Same as x := x shl 8; Unimportance 12000, cannot associate. operator
shr 65536 shr 8 Bit shift right, in this case returns 256. Unimportance 4000, associativity left to right. operator
shr= x shr=8; Same as x := x shr 8; Unimportance 12000, cannot associate. operator
sin sin(radians) Sine. Returns the same data type as input. Doesn't work on int type. function
sinh sinh(x) Hyperbolic sine. Doesn't work on type int. function
sint var s:sint(10) 10-bit signed overflowing integer. If operation overflows, wrapped modulo 2^10. type
sint128 var a: sint128; Overflowing signed integer of 128 bits. If operation overflows, wrapped modulo 340282366920938463463374607431768211456. type
sint16 var a: sint16; Overflowing signed integer of 16 bits. If operation overflows, wrapped modulo 65536. type
sint32 var a: sint32; Overflowing signed integer of 32 bits. If operation overflows, wrapped modulo 4294967296. type
sint64 var a: sint64; Overflowing signed integer of 64 bits. If operation overflows, wrapped modulo 18446744073709551616. type
sint8 var a: sint8; Overflowing signed integer of 8 bits. If operation overflows, wrapped modulo 256. type
sleep w := sleep(w,1234567) Waits 1.234567 seconds without consuming CPU. function io
sparse sparse('a',1000000000) Like fill but compresses runs in the list so that repetition doesn't consume much memory. Uses B+ trees. function
sqrt sqrt(x) Square root of x. Doesn't work on int type. function
stacktrace stacktrace(a) If the parameter is an exception, prints to stderr the exception type and the stack trace inside the exception if stack trace is available inside the exception. NaNs don't produce stack traces. function
stat w,r := stat(w, d, f, flags); Returns numeric pieces of information about the file in f (type: bytes) relative to the directory d (type: dhandle) into r (type: list of int64) according to "flags", which are an ored combination of stat_flag_devmajor, stat_flag_devminor, stat_flag_inode, stat_flag_type, stat_flag_mode, stat_flag_nlink, stat_flag_uid, stat_flag_gid, stat_flag_rdevmajor, stat_flag_rdevminor, stat_flag_size, stat_flag_optimaliosize, stat_flag_allocated, stat_flag_atime, stat_flag_mtime, stat_flag_ctime. This is the order in which the values are returned. Values not requested are not present in the list. If the f is an absolute path, d is unused except if it contains an exception. w is the world variable. function io
stat_flag_allocated stat(,,,stat_flag_allocated) How many bytes the file (including its indirect blocks and unused space in the last block) is taking up on the disk (may be different from file size). constant io
stat_flag_atime stat(,,,stat_flag_atime) Last access time (atime) in microseconds. The user may turn off atime updates when mounting a filesystem. Jan 1 1970 0:00:00 UTC corresponds to 0 microseconds and they grow 1 000 000 microseconds a second except when a leap second (23:59:59,23:59:60,00:00:00) is inserted, the microseconds jump back 1 second at the moment :59 flips into :60. If a leap second is left out (23:59:58,00:00:00), microseconds jump 1 second forward at the moment :58 flips into :00. They also jump when system time is adjusted. constant io
stat_flag_ctime stat(,,,stat_flag_ctime) Last change time (ctime) in microseconds. The meaning and consistency of ctime depends on operating system. Jan 1 1970 0:00:00 UTC corresponds to 0 microseconds and they grow 1 000 000 microseconds a second except when a leap second (23:59:59,23:59:60,00:00:00) is inserted, the microseconds jump back 1 second at the moment :59 flips into :60. If a leap second is left out (23:59:58,00:00:00), microseconds jump 1 second forward at the moment :58 flips into :00. They also jump when system time is adjusted. constant io
stat_flag_devmajor stat(,,,stat_flag_devmajor) Major number of the block device on which the filesystem is mounted. constant io
stat_flag_devminor stat(,,,stat_flag_devminor) Minor number of the block device on which the filesystem is mounted. constant io
stat_flag_gid stat(,,,stat_flag_gid) Group ID. constant io
stat_flag_inode stat(,,,stat_flag_inode) Inode number. constant io
stat_flag_mode stat(,,,stat_flag_mode) Bits 11-10-9-8-7-6-5-4-3-2-1-0 UGSrwxrwxrwx (SUID, SGID, sticky, rwx for user, rwx for group, rwx for others, rwx means read write execute). constant io
stat_flag_mtime stat(,,,stat_flag_mtime) Last modification time in microseconds. Jan 1 1970 0:00:00 UTC corresponds to 0 microseconds and they grow 1 000 000 microseconds a second except when a leap second (23:59:59,23:59:60,00:00:00) is inserted, the microseconds jump back 1 second at the moment :59 flips into :60. If a leap second is left out (23:59:58,00:00:00), microseconds jump 1 second forward at the moment :58 flips into :00. They also jump when system time is adjusted. constant io
stat_flag_nlink stat(,,,stat_flag_nlink) Number of hard links to the file. constant io
stat_flag_optimaliosize stat(,,,stat_flag_optimaliosize) Recommended I/O size for best performance. constant io
stat_flag_rdevmajor stat(,,,stat_flag_rdevmajor) If the file is a character or block device, major number of the device. constant io
stat_flag_rdevminor stat(,,,stat_flag_rdevminor) If the file is a character or block device, minor number of the device. constant io
stat_flag_size stat(,,,stat_flag_size) File size as shown to the user. constant io
stat_flag_type stat(,,,stat_flag_type) One of stat_type_* constants. constant io
stat_flag_uid stat(,,,stat_flag_uid) Owner user ID. constant io
stat_lazy r := stat_lazy(d, f, flags); Works reliably only when data accessed don't change during program execution. Returns numeric pieces of information about the file in f (type: bytes) relative to the directory d (type: dhandle) into r (type: list of int64) according to "flags", which are an ored combination of stat_flag_devmajor, stat_flag_devminor, stat_flag_inode, stat_flag_type, stat_flag_mode, stat_flag_nlink, stat_flag_uid, stat_flag_gid, stat_flag_rdevmajor, stat_flag_rdevminor, stat_flag_size, stat_flag_optimaliosize, stat_flag_allocated, stat_flag_atime, stat_flag_mtime, stat_flag_ctime. This is the order in which the values are returned. Values not requested are not present in the list. If the f is an absolute path, d is unused except if it contains an exception. function io
stat_type_blockdev if stat(,,,stat_flag_type) = stat_type_blockdev Block device. constant io
stat_type_chardev if stat(,,,stat_flag_type) = stat_type_chardev Character device. constant io
stat_type_directory if stat(,,,stat_flag_type) = stat_type_directory Directory. constant io
stat_type_fifo if stat(,,,stat_flag_type) = stat_type_fifo Named or unnamed pipe. constant io
stat_type_file if stat(,,,stat_flag_type) = stat_type_file Regular file. constant io
stat_type_link if stat(,,,stat_flag_type) = stat_type_link Symbolic link. constant io
stat_type_socket if stat(,,,stat_flag_type) = stat_type_socket UNIX, TCP, UDP or other socket. constant io
statfs_flag_bsize dstatfs(,,statfs_flag_bsize) Return the filesystem block size. constant io
statfs_flag_flags dstatfs(,,statfs_flag_flags) Return statfs_st_* flags ored together. constant io
statfs_flag_fravail dstatfs(,,statfs_flag_fravail) Free space for ordinary users on the filesystem in the unit of fragments. constant io
statfs_flag_frfree dstatfs(,,statfs_flag_frfree) Free space for root (administrator) on the filesystem in the unit of fragments. constant io
statfs_flag_frsize dstatfs(,,statfs_flag_frsize) Fragment size. constant io
statfs_flag_frtotal dstatfs(,,statfs_flag_frtotal) Size of the whole filesystem (including used and free space) counted in fragments. It depends on the operating system whether it counts preallocated metadata or not. constant io
statfs_flag_fsid dstatfs(,,statfs_flag_fsid) It is a value that uniquely identifies a mounted filesystem within the running system for the purpose of determining whether two paths belong to the same mounted filesystem. On WIndows and OS/2 returns the disk letter in ASCII. constant io
statfs_flag_inavail dstatfs(,,statfs_flag_inavail) Number of free inodes for ordinary user on that filesystem if the filesystem supports reporting this information, otherwise (e.g. Windows, O/2) 0. constant io
statfs_flag_infree dstatfs(,,statfs_flag_infree) Number of free inodes for superuser on that filesystem if the filesystem supports reporting this information, otherwise (e.g. Windows, O/2) 0. constant io
statfs_flag_intotal dstatfs(,,statfs_flag_intotal) Total number of inodes on that filesystem if the filesystem supports reporting this information, otherwise (e.g. Windows, O/2) 0. constant io
statfs_flag_namelen dstatfs(,,statfs_flag_namelen) Actual maximum file (not path) name length. No need to subtract 1 for any terminator byte. constant io
statfs_st_mandlock if (retval and statfs_st_mandlock) <> 0 Returned flag from dstatsfs and fstatfs. Mandatory locking enabled. constant io
statfs_st_noatime if (retval and statfs_st_noatime) <> 0 Returned flag from dstatsfs and fstatfs. atime is turned off for the whole filesystem (mount -o noatime). constant io
statfs_st_nodev if (retval and statfs_st_nodev) <> 0 Returned flag from dstatsfs and fstatfs. nodev option enabled - block and character devices are not allowed. constant io
statfs_st_nodiratime if (retval and statfs_st_nodiratime) <> 0 Returned flag from dstatsfs and fstatfs. atime is turned off on directories only (mount -o nodiratime). constant io
statfs_st_noexec if (retval and statfs_st_noexec) <> 0 Returned flag from dstatsfs and fstatfs. Flag noexec - executing files from this filesystem is not allowed. constant io
statfs_st_nosuid if (retval and statfs_st_nosuid) <> 0 Returned flag from dstatsfs and fstatfs. setuid execution is not allowed. constant io
statfs_st_readonly if (retval and statfs_st_readonly) <> 0 Returned flag from dstatsfs and fstatfs. Filesystem is read only. constant io
statfs_st_relatime if (retval and statfs_st_relatime) <> 0 Returned flag from dstatsfs and fstatfs. Mounted with the option relatime (see man mount). constant io
statfs_st_synchronous if (retval and statfs_st_synchronous) <> 0 Returned flag from dstatsfs and fstatfs. The filesystem writes all files synchronously - implicitly does sync on each write. constant io
stdib/msgque.ajla uses msgque; msgqueue_any, msgqueue_is_nonempty, msgqueue_new, msgqueue_peek_nonblock, msgqueue_peek_tag_nonblock, msgqueue_receive, msgqueue_receive_nonblock, msgqueue_receive_tag, msgqueue_receive_tag_nonblock, msgqueue_replace, msgqueue_send, msgqueue_wait unit
stdilb/glob.ajla uses glob; glob_bytes, glob_string unit
stdlib/box.ajla uses box; box_get, box_new, box_set unit
stdlib/charset.ajla uses charset; ascii_locase, ascii_to_string, ascii_upcase, bytes_locase, bytes_upcase, char_fallback, char_length, char_locase, char_to_unicode, char_upcase, char_validate, charset_list, charset_name_normalize, classify_character, locale_console_init, locale_get, locale_get_char, locale_get_charset, locale_init, locale_to_string, locale_validate, locale_validate_character, n_combining_characters, string_length, string_locase, string_to_ascii, string_to_locale, string_to_utf8, string_upcase, utf8_get_char, utf8_to_string, utf8_validate unit
stdlib/exception.ajla uses exception; exception_copy, exception_make, exception_make_str unit
stdlib/ffi.ajla uses ffi; ffi_callback_cancel, ffi_callback_create, ffi_callback_supported, ffi_callback_wait, ffi_create_structure, ffi_decode_double, ffi_decode_float, ffi_decode_longdouble, ffi_default_library, ffi_destructor_allocate, ffi_destructor_call, ffi_destructor_destroy, ffi_destructor_free, ffi_destructor_new, ffi_encode_double, ffi_encode_float, ffi_encode_longdouble, ffi_function_call, ffi_function_create, ffi_function_create_with_flags, ffi_get_alignment, ffi_get_size, ffi_get_structure_offset, ffi_handle_to_number, ffi_integer_type, ffi_number_to_handle, ffi_open_library, ffi_open_library_raw_name, ffi_peek, ffi_peek_array, ffi_peek_int_array, ffi_peek_zstring, ffi_poke, ffi_poke_array, ffi_poke_int_array, ffi_poke_zstring, ffi_unsafe_get_world unit
stdlib/heap.ajla uses heap; heap_extract, heap_from_list, heap_init, heap_insert, heap_is_nonempty, heap_peek, heap_size unit
stdlib/io.ajla uses io; atomic_enter, atomic_exit, bclone, bcontiguous, bdata, bdata_lazy, bhole, bhole_lazy, bopen, bopen_lazy, bread, bread_lazy, bsetsize, bsize, bsize_lazy, bwrite, chmod, chown, dmonitor, dnone, dopen, dopen_lazy, dpath, dpath_lazy, dread, dread_lazy, droot, dstatfs, exit, exit_msg, fdatasync, ffssync, fstat, fstat_lazy, fstatfs, fsync, get_host_name, get_monotonic_time, get_real_time, lchown, lstat, lstat_lazy, lutime, mkblockdev, mkchardev, mkdir, mklink, mkpipe, mksocket, mksymlink, mount_points, path_append, path_canonical, path_compare, path_config, path_contract, path_expand_home, path_get_cwd, path_is_absolute, path_is_dir_separator, path_is_root, path_is_separator, path_join, path_mkdir, path_shortcut_home, path_to_dir_file, path_write_atomic, path_xdg, pipe, read, read_full, read_lazy, read_partial, readlink, readlink_lazy, recover_world, register_dependence, rename, rmdir, ropen, ropen_lazy, sandbox_world, sleep, stat, stat_lazy, stty, sync, tty_background, tty_foreground, tty_size, uname, unlink, utime, wait_for_dereferenced, wcontiguous, wopen, write unit
stdlib/mutex.ajla uses mutex; mutex_lock, mutex_new, mutex_unlock unit
stdlib/prng.ajla uses prng; prng_get_int, prng_get_uint32, prng_init unit
stdlib/signal.ajla uses signal; signal_handle, signal_prepare, signal_unhandle, signal_wait unit
stdlib/socket.ajla uses socket; accept, address_family, bind, byte_sockopt, connect, connect_tcp, cstring_sockopt, getaddrinfo, getnameinfo, getpeername, getsockname, getsockopt, int_sockopt, listen, recvfrom, sendto, setsockopt, socket, sockopt_byte, sockopt_cstring, sockopt_int unit
stdlib/spawn.ajla uses spawn; get_process_output, load_program, spawn, spawn_command, spawn_raw, wait unit
stdlib/system.ajla // Not necessary to write uses system; abs, acos, acosh, any, any_list, array_fill, array_flatten, array_len, array_read, array_reverse, array_sort, array_sparse, array_to_list, array_write, asin, asinh, assert, atan, atan2, atanh, cbrt, ceil, clip, cos, cosh, debug, empty, exp, exp10, exp2, exponent, fill, floor, fmod, fork, format, fract, identity, infinite, infinite_repeat, infinite_uninitialized, inherit_division_ring_real_number, inherit_eq_array, inherit_eq_list, inherit_eq_ord, inherit_eq_tuple2, inherit_eq_tuple3, inherit_eq_tuple4, inherit_eq_tuple5, inherit_group_unit_ring, inherit_integer_number_fixed_integer_number, inherit_logical_integer_number, inherit_magma_monoid, inherit_monoid_group, inherit_ord_array, inherit_ord_integer_number, inherit_ord_list, inherit_ord_real_number, inherit_ord_tuple2, inherit_ord_tuple3, inherit_ord_tuple4, inherit_ord_tuple5, inherit_show_integer_number, inherit_show_real_number, inherit_unit_ring_division_ring, inherit_unit_ring_integer_number, instance_fixed_integer_number_sint, instance_fixed_integer_number_sint128, instance_fixed_integer_number_sint16, instance_fixed_integer_number_sint32, instance_fixed_integer_number_sint64, instance_fixed_integer_number_sint8, instance_fixed_integer_number_uint, instance_fixed_integer_number_uint128, instance_fixed_integer_number_uint16, instance_fixed_integer_number_uint32, instance_fixed_integer_number_uint64, instance_fixed_integer_number_uint8, instance_functor_array, instance_functor_list, instance_logical_bool, instance_monoid_list, instance_monoid_nat, instance_monoid_nat128, instance_monoid_nat16, instance_monoid_nat32, instance_monoid_nat64, instance_monoid_nat8, instance_number_int, instance_number_int128, instance_number_int16, instance_number_int32, instance_number_int64, instance_number_int8, instance_ord_bool, instance_ord_nat, instance_ord_nat128, instance_ord_nat16, instance_ord_nat32, instance_ord_nat64, instance_ord_nat8, instance_real_number_fixed_point, instance_real_number_floating, instance_real_number_rational, instance_real_number_real128, instance_real_number_real16, instance_real_number_real32, instance_real_number_real64, instance_real_number_real80, int_to_native, integer_number_to_integer_number, integer_number_to_real_number, internal, ipower, is_ready, is_uninitialized, is_uninitialized_record, join, ldexp, len, len_at_least, len_greater_than, list_begins_with, list_break, list_break_to_lines, list_break_whitespace, list_consumer, list_ends_with, list_filter, list_filter_idx, list_flatten, list_fold, list_fold_monoid, list_iterator, list_iterator_reverse, list_join, list_join_lines, list_left_pad, list_map_fold, list_map_fold_monoid, list_repeat, list_replace_substring, list_reverse, list_right_pad, list_search, list_search_backwards, list_search_backwards_fn, list_search_fn, list_search_substring, list_sort, list_sort_unique, list_string_break_to_lines, list_to_array, log, log10, log2, mantissa, map, max, min, mkmaybe, mktuple2, mktuple3, mktuple4, mktuple5, native_to_int, never, next_number, ntos, ntos_base, ntos_base_precision, power, prev_number, range, real_number_to_integer_number, real_number_to_real_number, report_memory_largest, report_memory_most, report_memory_summary, round, select, sgn, sin, sinh, sparse, sqrt, stacktrace, ston, ston_base, stop, tan, tanh, trace_off, trace_on, trunc, uninitialized, uninitialized_record, warning unit
stdlib/timezone.ajla uses timezone; calendar_to_time, time_to_calendar, timezone_gmt, timezone_init unit
stdlib/treemap.ajla uses treemap; instance_functor_treemap, treemap_delete, treemap_first, treemap_init, treemap_insert, treemap_is_nonempty, treemap_iterator, treemap_iterator_reverse, treemap_last, treemap_next, treemap_prev, treemap_search, treemap_search_default, treemap_size, treemap_test, treeset_clear, treeset_first, treeset_from_list, treeset_init, treeset_intersection, treeset_is_nonempty, treeset_iterator, treeset_iterator_reverse, treeset_last, treeset_next, treeset_prev, treeset_set, treeset_size, treeset_test, treeset_union unit
stdlib/z3.ajla uses z3; z3_eval_smtlib2_string, z3_eval_smtlib2_string_noret, z3_mk_context, z3_mk_world unit
ston a := 2*ston(mystr); Convert string to signed integer number in base 10. The string must be a block of digits 0-9 at least 1 digit long and optionally preceded by a single + or single - but not both. Can't contain other characters not even spaces, newline or NUL! If this is not met, returns exception class ec_sync type error_invalid_operation aux 0. function
ston_base hex := ston_base(mystr, 16); Convert string to signed integer number in base 16 (selectable from 2 to 36). The string must be a block of digits 0-9a-zA-Z at least 1 digit long and optionally preceded by a single + or single - but not both. Must not contain digits higher than appropriate for given base. Can't contain other characters not even spaces, newline or NUL! If this is not met, returns exception class ec_sync type error_invalid_operation aux 0. function
stop eval stop("point A"); Prints "DEBUG MESSAGE: stop at point A" to stderr and on Linux, *BSD, Irix, AIX, HP-UX, macOS, SCO, Solaris, Tru64, Minix pauses the process by signal STOP (like pressing CTRL-Z). On Windows (outside Cygwin) and OS/2 doesn't pause, just prints a warning that it's not supported. On Cygwin it works but with about 500 ms delay so a piece of the program after still gets executed. On Haiku it stops the process but doesn't return to the shell. function
string var s:string; An alias for list(char). type
stty w := stty(w, h, flags : int); Sets flags (ored constants stty_flag_*) for terminal in h (type: handle). w is the world variable. function io
stty_flag_nocrlf stty(,,stty_flag_nocrlf) On the output from the program to the terminal it turns off LF->CRLF conversion. constant io
stty_flag_noecho stty(,,stty_flag_noecho) Turns off echoing of characters typed by the user. constant io
stty_flag_nosignal stty(,,stty_flag_nosignal) Disables generation of signals when the user presses CTRL-C, CTRL-Z or CTRL-\. constant io
stty_flag_raw stty(,,stty_flag_raw) Disables line editing on the terminal. constant io
sync w := sync(w); Syncs all filesystems. On some systems (not on Linux>=1.3.20) it can return before the sync is completed. function io
tan tan(radians) Tangent. Returns the same data type as input. Doesn't work on int type. function
tanh tanh(x) Hyperbolic tangent. Doesn't work on type int. function
then if a<0 then[b-=1;]else[b+=1;] If a is less than zero, decrements b, otherwise increments b keyword
trace_off eval trace_off; Turns off tracing according to the function trace_on. function
trace_on eval trace_on; If tracing is compiled into Ajla, turns it on, which prints every Ajla opcode being executed. function
treemap var m:treemap(bytes, real80); A key-value store mapping byte string type to real80. Implemented as an AVL tree. type
treeset var a:treeset(real64); A set containing members of type real64. Implemented as an AVL tree. type
true var b:bool := true; True value for boolean purpose. keyword
trunc trunc(x) Rounds towards zero. function
tty_background w := tty_background(w); Switches the process to background as if the user pressed CTRL-Z. On DOS, OS/2 or Windows doesn't do anything. w is the world variable. function io
tty_foreground tty_foreground(w) : (world, bool) Tests whether the process is in foreground. If yes, returns true, otherwise false. w is the world variable. function io
tty_size w, nxr, nyr, oxr, oyr := tty_size(w, h); w is the world variable. Returns size of terminal pointed to by h (type: handle). nxr and nyr (type: int) are width and height in characters. oxr and oyr (type: int) are 0 on all systems except Windows. On Windows it's the offset of the beginning of the visible portion of the terminal in the window (for the case the user moves the scroll bars at right and bottom edges of the window). function io
tuple2 tuple2(int,real) A tuple holding 2 values of type int and real. type
tuple3 tuple3(int,real,int) A tuple holding 3 values of types int, real, int. type
tuple4 tuple4(int, int, real, string) A tuple holding 4 values of types int, int, real, string. type
tuple5 tuple5(int,real,int,int,string) A tuple holding 5 values of types int, real, int, int, string. type
type type byte := uint8; Declares the type byte to be an alias of the type uint8. keyword
uint var s:uint(12) 12-bit unsigned overflowing integer. If operation overflows, wrapped modulo 2^12. type
uint128 var a: uint128; Overflowing signed integer of 128 bits. If operation overflows, wrapped modulo 340282366920938463463374607431768211456. type
uint16 var a: uint16; Overflowing signed integer of 16 bits. If operation overflows, wrapped modulo 65536. type
uint32 var a: uint32; Overflowing signed integer of 32 bits. If operation overflows, wrapped modulo 4294967296. type
uint64 var a: uint64; Overflowing signed integer of 64 bits. If operation overflows, wrapped modulo 18446744073709551616. type
uint8 var a: uint8; Overflowing signed integer of 8 bits. If operation overflows, wrapped modulo 256. type
uname retval := uname(uname_flag_ajla_version or uname_flag_flavor); Returns multiple pieces of information about the system in retval (type: list(bytes)), which is a list of strings (each string of type bytes). To request multiple pieces of information, or together corresponding uname_flag_* flags and they will be returned in the sequence uname_flag_ajla_version, uname_flag_flavor, uname_flag_system, uname_flag_release, uname_flag_version, uname_flag_machine. Pieces of information which weren't requested will be left out completely. function io
uname_flag_ajla_version uname(uname_flag_ajla_version Returns the version of Ajla, example "0.3.1". constant io
uname_flag_flavor uname(uname_flag_flavor) Type of the operating system: Unix, Cygwin, DOS, Windows or OS/2. constant io
uname_flag_machine uname(uname_flag_machine) Architecture of the computer, for example aarch64 or x86_64. constant io
uname_flag_release uname(uname_flag_release) Operating system version, for example 6.6.127. constant io
uname_flag_system uname(uname_flag_system) Operating system name, for example GNU/Linux. constant io
uname_flag_version uname(uname_flag_version) A string identifying the operating system kernel, for example "#1 SMP PREEMPT Fri Feb 27 19:51:54 CET 2026". constant io
uninitialized uninitialized(int) Returns an exception class ec_sync, type error_array_entry_not_initialized, aux 0 inside data type int. function
uninitialized_record uninitialized_record(real); Returns an exception class ec_sync, type error_record_field_not_initialized, aux 0 inside data type real. function
unit_type var a:unit_type; Variable a can hold only one value - unit_value, or an exception. type
unlink w := unlink(w,dh, fp); Deletes the file with path fp (type: bytes). If fp is relative, directory dh (type: dhandle) is taken as base directory. w is the world variable. It works on every type of file except a directory, i.e. file, symlink, hard link, named pipe, block device, char device. If an error occurs, returns an exception class ec_syscall, type error_system (aux is system_error_*), error_errno (aux is errno number), error_os2 (aux is OS/2 error number), or error_error_win32 (aux is Window error number). If you try to delete a directory it returns exception class ec_sync, type error_system, aux system_error_eisdir. function io
uses uses heap; Imports a unit from the standard library or from the program directory. For example "uses heap;" imports the file "stdlib/heap.ajla". keyword
utime w := utime(w,d,f, atime, mtime) : world; Changes atime and mtime of file with filename f (type: bytes) in 64-bit microseconds and ctime to current time. w is the world variable. Jan 1 1970 0:00:00 UTC corresponds to 0 microseconds and they grow 1 000 000 microseconds a second except when a leap second (23:59:59,23:59:60,00:00:00) is inserted, the microseconds jump back 1 second at the moment :59 flips into :60. If a leap second is left out (23:59:58,00:00:00), microseconds jump 1 second forward at the moment :58 flips into :00. They also jump when system time is adjusted. If the path ends with a symlink, it changes the times for the symlink target. If f is relative, directory d (type: dhandle) is used. function io
var var x : int := 10; Declare a variable while specifying the type. keyword
var var x : int, y : real64 := 10, 20; Declare and initialize two variables at once, type is explicitly specified. keyword
var var x : int, y : real64; Declare several variables at once, specify types but don't initialize. keyword
var var x := 10; Declare a variable, the type is inferred. keyword
var var x, y := 10, 20; Declare and initialize two variables at once, type is inferred. keyword
w w := write(w, h[1], "Hello"); A token that must be passed to and returned from all functions that do I/O to sequence the I/O properly. variable
wait_for_dereferenced w := wait_for_dereferenced(w); If there are threads which have been already killed and haven't been terminated yet, it waits for their termination. function io
warning eval warning("negative input!"); If warnings are enabled by passing --warnings to the ajla executable, prints to stderr "WARNING: negative input!" function
wcontiguous w := wcontiguous(w, h, size); Allocates a contiguous space for "size" bytes in the file with handle h (type: handle). Only some of the operating systems (Linux and OS/2) support preallocation of file data. If the operating system doesn't support it, the function returns with success and does nothing. w is the world variable. size is type int64. function io
wopen w,h := wopen(w, d, f, flags, perms) ; Opens a file in write mode and returns the handle "h" to it (type: handle). d (type: dhandle) is the base directory that is used for file name lookup. f is the file name (type: bytes). flags (type: int) contain one or more of open_flag_append, open_flag_create, open_flag_must_create, open_flag_no_follow. open_flag_append specifies that we want to append to the file rather than overwrite it, open_flag_create specifies that we want to create the file if it doesn't exist, open_flag_must_create specifies that we want to fail with an error if the file exists, open_flag_no_follow suppresses the dereferencing of the last symlink in a file name. perms represents the permissions of the file if it is created and uses Unix permission bits: 876 is user's read write execute (rwx), 543 is group's rwx and 210 is others' r rwx. Bits are numbered from the least significant bit. You can also use the constants open_mode_* . In case of a symlink it opens the file pointed to unless it's prohibited by open_flag_no_follow. w is the world variable. function io
world fn main(w : world A token that must be passed to and returned from all functions that do I/O to sequence the I/O properly. type
write w := write(w, h, s : bytes) Writes the block of bytes s (type: bytes) to the write handle h(type: handle). w is the world variable. In case of error returns exception class ec_syscall, type error_system, error_errno, error_os2, error_os2_socket, error_win32. function io
write write(h[1],"Hello, world!"+nl); Prints "Hello, world!" onto stdout. h[2] is stderr. function
xor a xor b Bitwise exclusive or. Unimportance 9000, associates left to right. operator
xor a<0 xor b<0 Logical exclusive or. Unimportance 9000, associates left to right. operator
xor= a xor=b; Same as a := a xor b; Unimportance 12000, cannot associate. operator