Type | Range | Operators |
---|---|---|
i32 / int | -2147483648 .. 2147483647 | +, -, *, /, % <<, >>, &, |, ^ <, <=, ==, !=, >=, > |
u32 / uint | 0 .. 4294967295 | +, -, *, /, % <<, >>, &, |, ^ <, <=, ==, !=, >=, > |
i64 / long | -9223372036854775808 .. 9223372036854775807 | +, -, *, /, % <<, >>, &, |, ^ <, <=, ==, !=, >=, > |
u64 / ulong | 0 .. 18446744073709551615 | +, -, *, /, % <<, >>, &, |, ^ <, <=, ==, !=, >=, > |
f32 / float | 3.4e-38 .. 3.4e38 can be negative |
+, -, *, /, % <, <=, ==, !=, >=, > |
f64 / double | 1.7e-308 .. 1.7e308 can be negative |
+, -, *, /, % <, <=, ==, !=, >=, > |
bool | false, true | &&, || ==, != ! &&&, ||| (lazy evaluated, can not be overloaded) |
string | standard C string | + |
char | standard C character | +, - ==, != |
handle | none | ==, != |
file | none | none |
dir | none | none |
seq<T> | T is a type | none |
Keyword | Example | Description |
---|---|---|
mutable | ..., mutable string s, ... | Can only be used in function argument. Tells the compiler the content of the passed object can be altered. Note that, the object itself can not be replaced. |
Name | Signature | Description |
---|---|---|
write | (string) [impure] | Write string to the standard output. |
read | () : string [impure] | Read a line from the standard input. |
read | (char delim) : string [impure] | Read a delim terminated string from the standard input. |
ror | (T, T) : T | Rotate right. T can be: i32, u32, i64, u64. |
sqrt | (T) : T | Calculate square root of number (optimized algorithm for integers). T can be: i32, u32, i64, u64, f32, f64. |
log | (T) : T | Calculate e-based logarithm. T can be: f32, f64. |
exp | (T) : T | Calculate e-based exponentional. T can be: f32, f64. |
pow | (T a, T b) : f64 | Calculate a^b. T can be: f32, f64. |
sin | (T) : T | Calculate the sine (in radian). T can be: f32, f64. |
cos | (T) : T | Calculate the cosine (in radian). T can be: f32, f64. |
tan | (T) : T | Calculate the tangent (in radian). T can be: f32, f64. |
asin | (T) : T | Calculate the arcsine (in radian). T can be: f32, f64. |
acos | (T) : T | Calculate the arccosine (in radian). T can be: f32, f64. |
atan | (T) : T | Calculate the arctangent (in radian). T can be: f32, f64. |
atan2 | (T y, T x) : T | Calculate the arctangent of y/x (in radian). T can be: f32, f64. |
strcmp | (string a, string b) : i32 | Compare strings (case sensitive). Return <0 if a<b; 0 if a==b; >0 if a>b. |
stricmp | (string a, string b) : i32 | Compare strings (case insensitive). Return <0 if a<b; 0 if a==b; >0 if a>b. |
streq | (string a, string b) : bool | Same as strcmp(a, b)==0 |
strieq | (string a, string b) : bool | Same as stricmp(a, b)==0 |
strne | (string a, string b) : bool | Same as strcmp(a, b)!=0 |
strine | (string a, string b) : bool | Same as stricmp(a, b)!=0 |
strcat | (string, string) : string | Concatenate the two strings. |
strrev | (string) : string | Return the argument in reverse. |
substr | (string str, u32 offs, u32 count) : string | Return the part of the string. |
strlen | (string) : u32 | Return the length of the string. |
strlower | (string) : string | Return the string in lowercase. |
strupper | (string) : string | Return the string in uppercase. |
chartostring | (char) : string | Convert a single character to string. |
getstrchar | (string s, u32 i) : char | Same as s[i] |
setstrchar | (string s, u32 i, char ch) : string | Return the string, but i-th character is replaced with ch. |
charcmp | (char a, char b) : i32 | Compare two characters (case sensitive). Return <0 if a<b; 0 if a==b; >0 if a>b. |
charadd | (char, char) : i32 | Add two characters, resulting an other character. |
charsub | (char, char) : i32 | Subtract two characters, resulting an other character. |
charinc | (char ch, i32 i) : char | Calculate ch+i. |
chardiff | (char, char) : i32 | Return the difference between the ASCII codes of the characters. |
tos | (T) : string | Convert to string. T can be: string, char, bool, i32, u32, i64, u64, f32, f64. |
tobool | (string) : bool | Convert string to boolean. (true, on, 1, yes) |
toi32 | (T) : i32 | Convert to i32. May raise ConstraintErrorException. T can be: i32, u32, i64, u64, f32, f64. |
tou32 | (T) : u32 | Convert to u32. May raise ConstraintErrorException. T can be: i32, u32, i64, u64, f32, f64. |
toi64 | (T) : i64 | Convert to i64. May raise ConstraintErrorException. T can be: i32, u32, i64, u64, f32, f64. |
tou64 | (T) : u64 | Convert to u64. May raise ConstraintErrorException. T can be: i32, u32, i64, u64, f32, f64. |
tof32 | (T) : f32 | Convert to f32. May raise ConstraintErrorException. T can be: i32, u32, i64, u64, f32, f64. |
tof64 | (T) : f64 | Convert to f64. May raise ConstraintErrorException. T can be: i32, u32, i64, u64, f32, f64. |
nullhandle | () : handle | Return the null handle. |
seqlen | (seq<T>) : u32 | Return the number of elements in the sequence. |
loext | (seq<T>, T) : seq<T> | Append an element to the low end. |
hiext | (seq<T>, T) : seq<T> | Append an element to the high end. |
lorem | (seq<T>) : seq<T> | Remove an element from the low end. |
hirem | (seq<T>) : seq<T> | Remove an element from the high end. |
lov | (seq<T>) : T | Return the element at the low end. |
hiv | (seq<T>) : T | Return the element at the high end. |
lopop | (seq<T>) : seq<T>, T | Remove and return the element at the low end. |
hipop | (seq<T>) : seq<T>, T | Remove and return the element at the high end. |
seqfill | (T elem, u32 count) : seq<T> | Create a new sequence filled with the specified number of the specified element. |
subseq | (seq<T> s, u32 offs, u32 count) : seq<T> | Return the part of the sequence |
fopen | (string, char) : file [impure] | Open a file. |
fclose | (file) [impure] | Close a previously opened file. |
feof | (file) : bool [impure] | Check whether the file is at end of the file. |
freadchar | (file) : char [impure] | Read a character from the file. |
freadbool | (file) : bool [impure] | Read a boolean from the file. |
freadstr | (file) : string [impure] | Read a zero-terminated string from the file. |
freadln | (file) : string [impure] | Read a line from the file. |
freadi32 | (file) : i32 [impure] | Read an i32 from the file. |
freadu32 | (file) : u32 [impure] | Read an u32 from the file. |
freadi64 | (file) : i64 [impure] | Read an i64 from the file. |
freadu64 | (file) : u64 [impure] | Read an u64 from the file. |
freadf32 | (file) : f32 [impure] | Read an f32 from the file. |
freadf64 | (file) : f64 [impure] | Read an f64 from the file. |
fwriteln | (file, string) [impure] | Write a line into the file. |
fwrite | (file, string) [impure] | Write a zero-terminate string into the file. |
fwrite | (file, T) [impure] | Write a T into the file. |
opendir | (string) : dir [impure] | Open a directory iterator for the specified directory. |
closedir | (dir) [impure] | Close the directory iterator. |
readdir | (dir) : bool [impure] | Read the next directory entry. Return false when the iteration is over. |
dirgetname | (dir) : string [impure] | Return the name of the current entry. |
dirgetmtime | (dir) : u32, u32, u32, u32, u32, u32 [impure] | Return the last modification date of the current entry. (year, month, day, hour, minutes, seconds). |
dirgetsize | (dir) : u64 [impure] | Return the size of the current entry. (0ul for directories). |
dirgettype | (dir) : char [impure] | Return the type of the current entry. ('D' for directories, 'F' for files). |
Name | Signature | Description |
---|---|---|
version | () : u32 | Returns the version of the Welltype environment. Value: 900 (hexadecimal) |