docs.std
This the documentation of smoλ's standard library. It is automatically kept up to date by periodically running the following command. That pulls from code annotations and overloaded implementations.
./smol docs/std.s --task doc
You may notice that lot of dependencies are marked as unsafe; this is not worrying but only indicates that extra trust should be placed on both the person writing the implementations because some of the language's safety features are turned off to bring to you low-level functionaltiy.
The following functionality that is ready to use without -or with minimal- external dependencies. It is organized into top-level files residing directly under std/
and files under its subfolders. Do not import the latter by themselves to safe development speed. As a final remark, overloaded implementations are split per the file declaring them; foreign imports are not shown. Numbers in brackets indicate the number of structural primitive values.
std.builtins
std/builtins.s
std.builtins.console unsafe
Standard library wrapping and simplification of C console commands.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
read
Reads several string and primitive types from console text input given by the user; they need to press enter after entering the input. String reading is restricted to 1024 bytes allocated on the heap. You can have more control of string reading on alternatives. Non-string variations of this method are restricted to local variables. Invalid inputs create service failures.
read(str[5]) → (str[5])
read(f64) → f64
read(u64) → u64
read(i64) → i64
std.builtins.err unsafe
Standard library implementations of error utilities.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
ok
Checks if an error code corresponds to no error. If it does not, the service fails while printing the type of error. Error codes can be user errors, buffer errors, unknown errors, or no errors.
ok(errcode error) → ()
assert
assert(bool condition,cstr error) → ()
print
Prints an interpretation of the error code. Error codes can be user errors, buffer errors, unknown errors, or no errors.
print(errcode error) → ()
fail
Causes the current service to fail given a String message. This creates a user error code.
fail(str[5] error) → ()
fail(cstr error) → ()
std.builtins.num unsafe
Standard library wrapping of C basic arithmetics and printing.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
not
Negation of a boolean. In general, for unary operations, there is NO equivalent operator to overload. This promotes a currying-based notation for manipulating single values.
Here is a simple example, though this is often used in conditional statements:
print(true:not)
not(bool x) → bool
exists
Checks if a pointer is non-null. Pointer access and manipulation is inherently unsafe and you should not encounter that in normal code writing. For those aiming to extend the standard library or who dabble with inherently unsafe use cases, this can be used to check for memory allocation failures and trigger a service failure to safely collapse the current execution state.
exists(ptr x) → bool
print
Prints a primitive number, character, or boolean to the console.
print(char message) → ()
print(bool message) → ()
print(u64 message) → ()
print(i64 message) → ()
print(f64 message) → ()
printin
Prints a primitive number, character, or boolean to the console without changing line.
printin(char message) → ()
printin(bool message) → ()
printin(u64 message) → ()
printin(i64 message) → ()
printin(f64 message) → ()
lt
Checks if the first number is less than the second and overloads the corresponding operator.
Here is an example:
print(1>=2)
lt(u64 x,u64 y) → bool
lt(f64 x,f64 y) → bool
lt(i64 x,i64 y) → bool
gt
Checks if the first number is greater than the second and overloads the corresponding operator.
Here is an example:
print(1>=2)
gt(u64 x,u64 y) → bool
gt(f64 x,f64 y) → bool
gt(i64 x,i64 y) → bool
le
Checks if the first number is less than or equal to the second and overloads the corresponding operator. Only the same number types can be compared, and explicit casts are required otherwise.
Here is an example demonstrating the need to use an f64 zero (0.0 and not 0) to compare with another read value of the same type:
x=f64:read
if x<0.0 -> print("negative")
else -> print("non-negative")
le(u64 x,u64 y) → bool
le(f64 x,f64 y) → bool
le(i64 x,i64 y) → bool
ge
Checks if the first number is greater than or equal to the second and overloads the corresponding operator. Only the same number types can be compared, and explicit casts are required otherwise.
Here is an example demonstrating the need to use an f64 zero (0.0 and not 0) to compare with another read value of the same type:
x=f64:read
if x>0.0 -> print("positive")
else -> print("non-positive")
ge(u64 x,u64 y) → bool
ge(f64 x,f64 y) → bool
ge(i64 x,i64 y) → bool
leq
Checks if the first number is less than or equal to the second.
leq(u64 x,u64 y) → bool
leq(f64 x,f64 y) → bool
leq(i64 x,i64 y) → bool
geq
Checks if the first number is greater than or equal to the second.
geq(u64 x,u64 y) → bool
geq(f64 x,f64 y) → bool
geq(i64 x,i64 y) → bool
eq
Checks if two primitives are equal and overloads the corresponding operator. Equality can be checked for all primitives, and is defined for other runtypes too in the standard library, such as strings.
Here is an example:
print(1==2)
eq(u64 x,u64 y) → bool
eq(f64 x,f64 y) → bool
eq(ptr x,ptr y) → bool
eq(bool x,bool y) → bool
eq(i64 x,i64 y) → bool
neq
Checks if two primitives are not equal and overloads the corresponding operator. Non-equality can be checked for all primitives, and is defined for other runtypes too in the standard library, such as strings.
Here is an example:
print(1!=2)
neq(ptr x,ptr y) → bool
neq(bool x,bool y) → bool
neq(f64 x,f64 y) → bool
neq(u64 x,u64 y) → bool
neq(i64 x,i64 y) → bool
add
Addition of two numbers of the same type and overloads the corresponding operator.
Here is an example:
print(1+2)
add(i64 x,i64 y) → i64
add(f64 x,f64 y) → f64
add(u64 x,u64 y) → u64
mod
Modulo operation for signed or unsigned integers. For i64, only positive divisors are allowed. Fails on zero divisor. Overloads the corresponding operator. Here is an example:
print(1%2)
mod(i64 x,i64 y) → i64
mod(u64 x,u64 y) → u64
sub
Subtraction of two numbers of the same type. Doing so for u64 will create a service failure if the result would be negative. Overloads the corresponding operator for numbers.
Here is an example that FAILS because the default integer type is u64:
print(1-2)
sub(f64 x,f64 y) → f64
sub(i64 x,i64 y) → i64
sub(u64 x,u64 y) → u64
mul
Multiplication of two numbers of the same type and overloads the corresponding operator.
Here is an example:
print(3*2)
mul(f64 x,f64 y) → f64
mul(i64 x,i64 y) → i64
mul(u64 x,u64 y) → u64
div
Division of two numbers of the same type. Division by zero for i64 or u64 creates a service failure, but for f64 it yields NaN. Overloads the corresponding operator. Here is an example that yields zero by performing integer division:
print(1/2)
div(f64 x,f64 y) → f64
div(i64 x,i64 y) → i64
div(u64 x,u64 y) → u64
negative
Returns the additive inverse (negation) of an i64 or f64. Does NOT overload any operation. Having u64 as the default type helps avoid many spurious negation errors, especially when memory handling is concerned.
Both examples below print -1:
print(0:i64-1:i64)
print(1:i64:negative)
negative(f64 x) → f64
negative(i64 x) → i64
std.builtins.range
Standard library implementation of u64 ranges.
next
Obtains the next element in the range. Using a combination of a range and next element traversal is safer than manually checking bounds.
Below is the main usage pattern. Notice that next's argument is an in-place constructed u64 number that is mutable to obtain the next value. The function progress the range's state and set that value.
range(10)
:while next(u64 &i)
print(i)
--
next(u64 self.start,u64 self.end,u64 self.step,u64& self.pos,u64& value) → bool
range
Defines a u64 range as a structural type (instead of nominal type). When directly using variables as ranges, the position should be mutable. A couple of calling conventions are provided for default values of 0 for start and 1 for step.
range(u64 end) → range(u64 start,u64 end,u64 step)
range(u64 start,u64 end) → range(u64 start,u64 end,u64 step)
range(u64 start,u64 end,u64 step) → (u64 start,u64 end,u64 step,u64 pos)
std.builtins.str unsafe
Standard library implementation of the extensible string model based on C pointers and an implementation for const char arrays.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
next
Retrieves the next element over a Split string iteration. Example: Split('I like bananas', ' '):while next(str& word) print(word) --
next(Split&[12] self,str&[5] value) → bool
String
A union between str and constant strings cstr
. Constant strings are those that generated by default when enclosing some text in quotients and are stored in the program memory.
Main usage is to abstract an argument's type by converting it to str. The conversion is a zero cost abstraction in that needless operations will be removed. But it still augments constant strings with length and first element inform if these are needed. Here is an example:
smo foo(String _s)
s = _s:str
...
--
str(nom,ptr contents,u64 length,char first,ptr memory) → (nom,ptr contents,u64 length,char first,ptr memory)
is
Compile-time check of a String exact type matching compared to an arbitrary type.
Example usage: smo foo(String s) with s:is(str) ... -- else ...----
is(cstr,cstr) → ()
is(str[5],str[5]) → ()
print
Prints strings or bools to the console.
print(str[5] message) → ()
print(cstr message) → ()
str
A memory allocated string and converters from constant strings and booleans to the type. Other standard library implementations provide more converters.
str(bool value) → str(nom,ptr contents,u64 length,char first,ptr memory)
str(cstr raw) → str(nom,ptr contents,u64 length,char first,ptr memory)
str(nom,ptr contents,u64 length,char first,ptr memory) → (nom,ptr contents,u64 length,char first,ptr memory)
printin
Prints strings or bools to the console without evoking a new line at the end.
printin(str[5] message) → ()
printin(cstr message) → ()
slice
slice(cstr self,u64 from) → str[5]
slice(str[5] self,u64 from) → str[5]
slice(cstr self,u64 from,u64 to) → str[5]
slice(str[5] self,u64 from,u64 to) → str[5]
IndependentString
A copy of the String union that can be used when a second argument is needed for a string of a potentially different variation.
str(nom,ptr contents,u64 length,char first,ptr memory) → (nom,ptr contents,u64 length,char first,ptr memory)
len
len(str[5] x) → u64
len(cstr x) → u64
eq
eq(cstr _x,str[5] _y) → bool
eq(str[5] _x,cstr _y) → bool
eq(str[5] _x,str[5] _y) → bool
eq(cstr _x,cstr _y) → bool
eq(char x,char y) → bool
at
at(str[5] x,u64 pos) → char
neq
neq(cstr _x,str[5] _y) → bool
neq(str[5] _x,cstr _y) → bool
neq(str[5] _x,str[5] _y) → bool
neq(cstr _x,cstr _y) → bool
neq(char x,char y) → bool
Split
Splits a String given a query String. Optionally, you may also provide a starting position, where the default is 0. The result of the split can be iterated through with next
. This does not allocate memory in that a substring is retrieved, so you might consider copying the splits - or store them on data structures like maps that automatically copy data if needed.
Split(cstr _query,str[5] _sep) → Split(nom,str[5] query,str[5] sep,u64& pos)
Split(str[5] _query,str[5] _sep) → Split(nom,str[5] query,str[5] sep,u64& pos)
Split(cstr _query,cstr _sep) → Split(nom,str[5] query,str[5] sep,u64& pos)
Split(str[5] _query,cstr _sep) → Split(nom,str[5] query,str[5] sep,u64& pos)
Split(nom,str[5] query,str[5] sep,u64& pos) → (nom,str[5] query,str[5] sep,u64 pos)
std.file unsafe
Standard library implementation of file management that uses the C filesystem.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
ReadFile
An opened file that is meant to be read only.
ReadFile(nom,ptr contents) → (nom,ptr contents)
WriteFile
An opened file that is meant to be read or write.
WriteFile(nom,ptr contents) → (nom,ptr contents)
to_end
Go to the end of a WriteFile. This is not implemented for ReadFile, as it makes more sense to just close the latter. May cause service failure due to external factors.
to_end(WriteFile&[2] f) → WriteFile[2]
File
A union between file types that allows common reading and positioning operations.
WriteFile(nom,ptr contents) → (nom,ptr contents)
ReadFile(nom,ptr contents) → (nom,ptr contents)
open
Opens a File given a String path, in which case you might get service failure due to external factors. Opening a WriteFile, may also cause service failure if the file already exists - in that case remove it first. On the other hand, a ReadFile must already exist to be opened.
open(WriteFile&[2],cstr _path) → WriteFile[2]
open(WriteFile&[2],str[5] _path) → WriteFile[2]
open(ReadFile&[2],cstr _path) → ReadFile[2]
open(ReadFile&[2],str[5] _path) → ReadFile[2]
to_start
Go to the beginning of a File. You can continue read or writing from there. May cause service failure due to external factors.
to_start(ReadFile&[2] f) → ReadFile[2]
to_start(WriteFile&[2] f) → WriteFile[2]
close
Closes an open file. This invalidates its internals completely and will make all other operations on it either do nothing or cause service failures.
close(ReadFile&[2] f) → ()
close(WriteFile&[2] f) → ()
write
Writes a string on a WriteFile.
write(WriteFile&[2] f,cstr _s) → ()
write(WriteFile&[2] f,str[5] _s) → ()
allocate_file
Creates a virtual file by of a given size on top of some memory allocator.
allocate_file(Arena&[8] memory,u64 size) → WriteFile[2]
allocate_file(Dynamic&[4] memory,u64 size) → WriteFile[2]
allocate_file(Stack&[1] memory,u64 size) → WriteFile[2]
allocate_file(Volatile&[9] memory,u64 size) → WriteFile[2]
allocate_file(Heap&[1] memory,u64 size) → WriteFile[2]
allocate_file(Volatile&[9] memory,u64 size) → WriteFile[2]
allocate_file(Arena&[8] memory,u64 size) → WriteFile[2]
next_chunk
Reads the next chunk of a file while using it as an iterator. It accomodates Arena and Volatile memories and different argument orders that allow you to use either the file or the memory as context.
Here is an example where volatile memory is used to avoid repeated or large allocations:
on Heap:allocate_volatile(1024)
ReadFile
:open("README.md")
:while next_chunk(str& chunk)
print(chunk)
----
next_chunk(ReadFile&[2] f,Arena&[8] memory,str&[5] value) → bool
next_chunk(ReadFile&[2] f,Arena&[8] memory,str&[5] value) → bool
next_chunk(Volatile&[9] memory,ReadFile&[2] f,str&[5] value) → bool
next_chunk(WriteFile&[2] f,Arena&[8] memory,str&[5] value) → bool
next_chunk(WriteFile&[2] f,Volatile&[9] memory,str&[5] value) → bool
next_chunk(Arena&[8] reader,ReadFile&[2] f,str&[5] value) → bool
next_chunk(Volatile&[9] memory,WriteFile&[2] f,str&[5] value) → bool
next_chunk(Volatile&[9] memory,WriteFile&[2] f,str&[5] value) → bool
next_chunk(Volatile&[9] memory,ReadFile&[2] f,str&[5] value) → bool
next_chunk(WriteFile&[2] f,Arena&[8] memory,str&[5] value) → bool
next_chunk(Arena&[8] reader,WriteFile&[2] f,str&[5] value) → bool
next_chunk(Arena&[8] reader,WriteFile&[2] f,str&[5] value) → bool
next_chunk(Arena&[8] reader,ReadFile&[2] f,str&[5] value) → bool
next_chunk(WriteFile&[2] f,Volatile&[9] memory,str&[5] value) → bool
next_chunk(ReadFile&[2] f,Volatile&[9] memory,str&[5] value) → bool
next_chunk(ReadFile&[2] f,Volatile&[9] memory,str&[5] value) → bool
len
Computes the size of a File in bytes.
len(ReadFile&[2] f) → u64
len(WriteFile&[2] f) → u64
next_line
Reads the next line of a file while using it as an iterator. It accomodates Arena and Volatile memories and different argument orders that allow you to use either the file or the memory as context.
Here is an example where volatile memory is used to avoid repeated or large allocations:
endl="n":str.first // optimized to just setting the new line character
on Heap:allocate_volatile(1024)
ReadFile("README.md")
:open("README.md")
:while next_line(str& line)
if line[line:len-1]==endl
line = line[0 to line:len-1]
--
print(line)
----
next_line(ReadFile&[2] f,Arena&[8] memory,str&[5] value) → bool
next_line(WriteFile&[2] f,Arena&[8] memory,str&[5] value) → bool
next_line(ReadFile&[2] f,Arena&[8] memory,str&[5] value) → bool
next_line(Volatile&[9] memory,WriteFile&[2] f,str&[5] value) → bool
next_line(Volatile&[9] memory,WriteFile&[2] f,str&[5] value) → bool
next_line(Arena&[8] reader,ReadFile&[2] f,str&[5] value) → bool
next_line(Volatile&[9] memory,ReadFile&[2] f,str&[5] value) → bool
next_line(WriteFile&[2] f,Volatile&[9] memory,str&[5] value) → bool
next_line(Arena&[8] reader,WriteFile&[2] f,str&[5] value) → bool
next_line(Arena&[8] reader,WriteFile&[2] f,str&[5] value) → bool
next_line(Arena&[8] reader,ReadFile&[2] f,str&[5] value) → bool
next_line(ReadFile&[2] f,Volatile&[9] memory,str&[5] value) → bool
next_line(WriteFile&[2] f,Arena&[8] memory,str&[5] value) → bool
next_line(Volatile&[9] memory,ReadFile&[2] f,str&[5] value) → bool
next_line(WriteFile&[2] f,Volatile&[9] memory,str&[5] value) → bool
next_line(ReadFile&[2] f,Volatile&[9] memory,str&[5] value) → bool
ended
Checks if the ending of the file has been reached. This is normal to be true for WriteFile.
ended(ReadFile&[2] f) → bool
ended(WriteFile&[2] f) → bool
is_file
Checks if a String path is a file system file.
is_file(cstr _path) → bool
is_file(str[5] _path) → bool
is_dir
Checks if a String path is a file system directory.
is_dir(cstr _path) → bool
is_dir(str[5] _path) → bool
remove_file
Deletes a file from the system. May cause service failure due to external factors or if the file is already open.
remove_file(cstr _path) → ()
remove_file(str[5] _path) → ()
create_dir
Creates a directory given a String path. May cause service failure due to external factors or if the directory already exists.
create_dir(cstr _path) → ()
create_dir(str[5] _path) → ()
std.map unsafe
Standard library implementation of maps that requires unsafe entry casts to u64.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
__unsafe_cast
__unsafe_cast(u64,f64 value) → u64
__unsafe_cast(u64,u64 value) → u64
__unsafe_cast(u64,i64 value) → u64
__unsafe_cast(u64,cstr value) → u64
__unsafe_cast(str[5],u64 value) → cstr
__unsafe_cast(str[5],ptr value) → cstr
__unsafe_cast(u64,ptr value) → u64
__unsafe_cast(str[5],cstr value) → cstr
__unsafe_cast(str[5],str[5] value) → str[5]
__unsafe_ret
__unsafe_ret(str[5],u64 value,ptr context) → str[5]
__unsafe_ret(i64,u64 value,ptr context) → i64
__unsafe_ret(f64,u64 value,ptr context) → f64
__unsafe_ret(u64,u64 value,ptr context) → u64
__map_prepare_key
__map_prepare_key(u64 value) → u64
__map_prepare_key(i64 value) → i64
__map_prepare_key(cstr value) → cstr
__map_prepare_key(u64 value,Arena&[8] memory) → u64
__map_prepare_key(u64 value,Dynamic&[4] memory) → u64
__map_prepare_key(u64 value,Stack&[1] memory) → u64
__map_prepare_key(u64 value,Volatile&[9] memory) → u64
__map_prepare_key(cstr value,Volatile&[9] memory) → cstr
__map_prepare_key(i64 value,Heap&[1] memory) → i64
__map_prepare_key(i64 value,Arena&[8] memory) → i64
__map_prepare_key(cstr value,Arena&[8] memory) → cstr
__map_prepare_key(str[5] value,Heap&[1] memory) → ptr
__map_prepare_key(f64 value) → f64
__map_prepare_key(f64 value,Volatile&[9] memory) → f64
__map_prepare_key(str[5] value,Arena&[8] memory) → ptr
__map_prepare_key(str[5] value,Arena&[8] memory) → ptr
__map_prepare_key(cstr value,Dynamic&[4] memory) → cstr
__map_prepare_key(str[5] value,Stack&[1] memory) → ptr
__map_prepare_key(str[5] value,Volatile&[9] memory) → ptr
__map_prepare_key(u64 value,Arena&[8] memory) → u64
__map_prepare_key(u64 value,Heap&[1] memory) → u64
__map_prepare_key(str[5] value,Dynamic&[4] memory) → ptr
__map_prepare_key(cstr value,Arena&[8] memory) → cstr
__map_prepare_key(i64 value,Arena&[8] memory) → i64
__map_prepare_key(cstr value,Volatile&[9] memory) → cstr
__map_prepare_key(f64 value,Dynamic&[4] memory) → f64
__map_prepare_key(i64 value,Dynamic&[4] memory) → i64
__map_prepare_key(str[5] value,Volatile&[9] memory) → ptr
__map_prepare_key(cstr value,Heap&[1] memory) → cstr
__map_prepare_key(f64 value,Arena&[8] memory) → f64
__map_prepare_key(i64 value,Volatile&[9] memory) → i64
__map_prepare_key(f64 value,Volatile&[9] memory) → f64
__map_prepare_key(f64 value,Arena&[8] memory) → f64
__map_prepare_key(str[5] value) → str[5]
__map_prepare_key(cstr value,Stack&[1] memory) → cstr
__map_prepare_key(f64 value,Heap&[1] memory) → f64
__map_prepare_key(u64 value,Volatile&[9] memory) → u64
__map_prepare_key(f64 value,Stack&[1] memory) → f64
__map_prepare_key(i64 value,Volatile&[9] memory) → i64
__map_prepare_key(i64 value,Stack&[1] memory) → i64
__map_prepare_value
__map_prepare_value(u64 value,Heap&[1] memory) → u64
__map_prepare_value(u64 value,Arena&[8] memory) → u64
__map_prepare_value(u64 value,Dynamic&[4] memory) → u64
__map_prepare_value(u64 value,Stack&[1] memory) → u64
__map_prepare_value(cstr value,Dynamic&[4] memory) → cstr
__map_prepare_value(cstr value,Volatile&[9] memory) → cstr
__map_prepare_value(str[5] value,Volatile&[9] memory) → ptr
__map_prepare_value(cstr value,Arena&[8] memory) → cstr
__map_prepare_value(cstr value,Arena&[8] memory) → cstr
__map_prepare_value(cstr value,Stack&[1] memory) → cstr
__map_prepare_value(str[5] value,Arena&[8] memory) → ptr
__map_prepare_value(i64 value,Volatile&[9] memory) → i64
__map_prepare_value(str[5] value,Dynamic&[4] memory) → ptr
__map_prepare_value(i64 value,Stack&[1] memory) → i64
__map_prepare_value(str[5] value,Heap&[1] memory) → ptr
__map_prepare_value(str[5] value,Arena&[8] memory) → ptr
__map_prepare_value(i64 value,Arena&[8] memory) → i64
__map_prepare_value(cstr value,Heap&[1] memory) → cstr
__map_prepare_value(str[5] value,Volatile&[9] memory) → ptr
__map_prepare_value(u64 value,Volatile&[9] memory) → u64
__map_prepare_value(f64 value,Volatile&[9] memory) → f64
__map_prepare_value(f64 value,Volatile&[9] memory) → f64
__map_prepare_value(cstr value,Volatile&[9] memory) → cstr
__map_prepare_value(i64 value,Dynamic&[4] memory) → i64
__map_prepare_value(f64 value,Stack&[1] memory) → f64
__map_prepare_value(f64 value,Dynamic&[4] memory) → f64
__map_prepare_value(f64 value,Arena&[8] memory) → f64
__map_prepare_value(i64 value,Arena&[8] memory) → i64
__map_prepare_value(str[5] value,Stack&[1] memory) → ptr
__map_prepare_value(f64 value,Arena&[8] memory) → f64
__map_prepare_value(i64 value,Volatile&[9] memory) → i64
__map_prepare_value(u64 value,Volatile&[9] memory) → u64
__map_prepare_value(f64 value,Heap&[1] memory) → f64
__map_prepare_value(i64 value,Heap&[1] memory) → i64
__map_prepare_value(u64 value,Arena&[8] memory) → u64
hash
hash(u64 _x) → u64
hash(cstr _s) → u64
hash(str[5] _s) → u64
len
Tracks the number of elements stored in each Map. Elements cannot be removed but can be replaced. Several variations exist for different map variations.
len(Map[17] self) → u64
len(Map[18] self) → u64
len(Map[10] self) → u64
len(Map[17] self) → u64
len(Map[10] self) → u64
len(Map[13] self) → u64
len(Map[10] self) → u64
len(Map[18] self) → u64
len(Map[18] self) → u64
len(Map[17] self) → u64
len(Map[18] self) → u64
len(Map[17] self) → u64
len(Map[17] self) → u64
len(Map[17] self) → u64
len(Map[13] self) → u64
len(Map[10] self) → u64
len(Map[18] self) → u64
len(Map[17] self) → u64
len(Map[17] self) → u64
len(Map[17] self) → u64
len(Map[17] self) → u64
len(Map[17] self) → u64
len(Map[17] self) → u64
len(Map[10] self) → u64
len(Map[13] self) → u64
len(Map[10] self) → u64
len(Map[18] self) → u64
len(Map[18] self) → u64
len(Map[18] self) → u64
len(Map[18] self) → u64
len(Map[13] self) → u64
len(Map[10] self) → u64
len(Map[17] self) → u64
len(Map[10] self) → u64
len(Map[13] self) → u64
len(Map[18] self) → u64
len(Map[17] self) → u64
len(Map[18] self) → u64
len(Map[10] self) → u64
len(Map[18] self) → u64
len(Map[10] self) → u64
len(Map[13] self) → u64
len(Map[10] self) → u64
len(Map[13] self) → u64
len(Map[10] self) → u64
len(Map[17] self) → u64
len(Map[10] self) → u64
len(Map[10] self) → u64
len(Map[18] self) → u64
len(Map[13] self) → u64
len(Map[18] self) → u64
len(Map[17] self) → u64
len(Map[10] self) → u64
len(Map[18] self) → u64
len(Map[10] self) → u64
len(Map[18] self) → u64
at
Gets an element from a Map given that it is the same type as its key. This overloads the bracket operator. Will cause service failure if the element is missing; check for its existence first.
Here is example usage that obtains a key's value:
map = Dynamic:Map(100, str, str) // str to str map on dynamic memory with 100 max size
map:put("hello", "world")
print(map["hello"])
at(Map[10] self,cstr _mkey) → (str[5] ret)
at(Map[10] self,cstr _mkey) → u64
at(Map[18] self,cstr _mkey) → (str[5] ret)
at(Map[17] self,cstr _mkey) → u64
at(Map[18] self,cstr _mkey) → i64
at(Map[18] self,cstr _mkey) → i64
at(Map[17] self,cstr _mkey) → i64
at(Map[10] self,cstr _mkey) → i64
at(Map[10] self,cstr _mkey) → u64
at(Map[17] self,cstr _mkey) → (str[5] ret)
at(Map[10] self,cstr _mkey) → (str[5] ret)
at(Map[17] self,cstr _mkey) → f64
at(Map[13] self,cstr _mkey) → i64
at(Map[10] self,cstr _mkey) → f64
at(Map[17] self,cstr _mkey) → f64
at(Map[13] self,cstr _mkey) → f64
at(Map[18] self,cstr _mkey) → f64
at(Map[17] self,cstr _mkey) → i64
at(Map[10] self,cstr _mkey) → i64
at(Map[10] self,cstr _mkey) → f64
at(Map[17] self,str[5] _key) → str[5]
at(Map[10] self,str[5] _key) → str[5]
at(Map[18] self,str[5] _key) → str[5]
at(Map[13] self,str[5] _key) → u64
at(Map[10] self,str[5] _key) → u64
at(Map[18] self,str[5] _key) → u64
at(Map[13] self,u64 _key) → str[5]
at(Map[17] self,u64 _key) → u64
at(Map[13] self,cstr _mkey) → (str[5] ret)
at(Map[10] self,u64 _key) → u64
at(Map[18] self,str[5] _key) → i64
at(Map[18] self,u64 _key) → i64
at(Map[18] self,cstr _mkey) → (str[5] ret)
at(Map[18] self,str[5] _key) → f64
at(Map[18] self,u64 _key) → f64
at(Map[17] self,u64 _key) → f64
at(Map[18] self,u64 _key) → str[5]
at(Map[18] self,u64 _key) → i64
at(Map[10] self,str[5] _key) → str[5]
at(Map[10] self,u64 _key) → f64
at(Map[10] self,u64 _key) → f64
at(Map[18] self,cstr _mkey) → u64
at(Map[10] self,u64 _key) → str[5]
at(Map[17] self,u64 _key) → i64
at(Map[10] self,str[5] _key) → i64
at(Map[18] self,str[5] _key) → u64
at(Map[18] self,cstr _mkey) → f64
at(Map[18] self,u64 _key) → u64
at(Map[17] self,u64 _key) → i64
at(Map[13] self,u64 _key) → f64
at(Map[10] self,str[5] _key) → u64
at(Map[17] self,u64 _key) → str[5]
at(Map[18] self,str[5] _key) → f64
at(Map[10] self,u64 _key) → str[5]
at(Map[17] self,cstr _mkey) → u64
at(Map[10] self,u64 _key) → u64
at(Map[17] self,str[5] _key) → f64
at(Map[13] self,str[5] _key) → i64
at(Map[13] self,cstr _mkey) → u64
at(Map[18] self,u64 _key) → f64
at(Map[13] self,u64 _key) → i64
at(Map[17] self,u64 _key) → u64
at(Map[18] self,str[5] _key) → str[5]
at(Map[17] self,str[5] _key) → u64
at(Map[18] self,u64 _key) → str[5]
at(Map[17] self,u64 _key) → str[5]
at(Map[18] self,u64 _key) → u64
at(Map[17] self,u64 _key) → f64
at(Map[10] self,str[5] _key) → f64
at(Map[17] self,str[5] _key) → f64
at(Map[10] self,u64 _key) → i64
at(Map[13] self,str[5] _key) → f64
at(Map[17] self,str[5] _key) → i64
at(Map[17] self,str[5] _key) → str[5]
at(Map[17] self,cstr _mkey) → (str[5] ret)
at(Map[13] self,u64 _key) → u64
at(Map[10] self,str[5] _key) → i64
at(Map[13] self,str[5] _key) → str[5]
at(Map[10] self,str[5] _key) → f64
at(Map[17] self,str[5] _key) → i64
at(Map[18] self,cstr _mkey) → u64
at(Map[10] self,u64 _key) → i64
at(Map[18] self,str[5] _key) → i64
at(Map[17] self,str[5] _key) → u64
Map
Constructs a map data type given a memory allocator, a maximum number of map elements that can be stored on it, and the types of keys and values. The maximum number of elements cannot be increased and is reserved as space beforehand for security. Str is used as a storage type for both all String values. Memory is reserved beforehand for the map's entries so that implementation is performant and can conform to any allocator. For string keys or values, the base allocator is also used to reserve space later for string copying to maintain lifetimes. Element insertion may fail if the map or base memory is out of space.
Here is an example of a string-based map, where known constant string (cstr) elements are placed by hand to prevent any additional memory allocation for them.
map = Stack:allocate_arena(32):Map(10, 1, u64) // do everything in 32 bytes with up to 10 entries
on map // open context to add the map as first argument when needed
1:put("entry 1")
2:put("entry 2")
3:put("entry 3")
--
print(map[3])
Map(Heap&[1] memory,u64 size,str[5],str[5]) → Map(nom,Heap&[1] memory,u64 size,str[5],str[5])
Map(Arena&[8] memory,u64 size,str[5],str[5]) → Map(nom,Arena&[8] memory,u64 size,str[5],str[5])
Map(Dynamic&[4] memory,u64 size,str[5],str[5]) → Map(nom,Dynamic&[4] memory,u64 size,str[5],str[5])
Map(Stack&[1] memory,u64 size,str[5],str[5]) → Map(nom,Stack&[1] memory,u64 size,str[5],str[5])
Map(Volatile&[9] memory,u64 size,str[5],str[5]) → Map(nom,Volatile&[9] memory,u64 size,str[5],str[5])
Map(Arena&[8] memory,u64 size,str[5],str[5]) → Map(nom,Arena&[8] memory,u64 size,str[5],str[5])
Map(Heap&[1] memory,u64 size,u64,str[5]) → Map(nom,Heap&[1] memory,u64 size,u64,str[5])
Map(Arena&[8] memory,u64 size,u64,str[5]) → Map(nom,Arena&[8] memory,u64 size,u64,str[5])
Map(Volatile&[9] memory,u64 size,u64,str[5]) → Map(nom,Volatile&[9] memory,u64 size,u64,str[5])
Map(Volatile&[9] memory,u64 size,u64,str[5]) → Map(nom,Volatile&[9] memory,u64 size,u64,str[5])
Map(Dynamic&[4] memory,u64 size,str[5],u64) → Map(nom,Dynamic&[4] memory,u64 size,str[5],u64)
Map(Stack&[1] memory,u64 size,str[5],u64) → Map(nom,Stack&[1] memory,u64 size,str[5],u64)
Map(Arena&[8] memory,u64 size,u64,u64) → Map(nom,Arena&[8] memory,u64 size,u64,u64)
Map(Stack&[1] memory,u64 size,u64,u64) → Map(nom,Stack&[1] memory,u64 size,u64,u64)
Map(Dynamic&[4] memory,u64 size,u64,u64) → Map(nom,Dynamic&[4] memory,u64 size,u64,u64)
Map(Volatile&[9] memory,u64 size,u64,u64) → Map(nom,Volatile&[9] memory,u64 size,u64,u64)
Map(Dynamic&[4] memory,u64 size,str[5],f64) → Map(nom,Dynamic&[4] memory,u64 size,str[5],f64)
Map(Volatile&[9] memory,u64 size,str[5],f64) → Map(nom,Volatile&[9] memory,u64 size,str[5],f64)
Map(Dynamic&[4] memory,u64 size,u64,f64) → Map(nom,Dynamic&[4] memory,u64 size,u64,f64)
Map(Arena&[8] memory,u64 size,str[5],u64) → Map(nom,Arena&[8] memory,u64 size,str[5],u64)
Map(Volatile&[9] memory,u64 size,u64,f64) → Map(nom,Volatile&[9] memory,u64 size,u64,f64)
Map(Volatile&[9] memory,u64 size,u64,f64) → Map(nom,Volatile&[9] memory,u64 size,u64,f64)
Map(Arena&[8] memory,u64 size,str[5],i64) → Map(nom,Arena&[8] memory,u64 size,str[5],i64)
Map(Volatile&[9] memory,u64 size,str[5],u64) → Map(nom,Volatile&[9] memory,u64 size,str[5],u64)
Map(Arena&[8] memory,u64 size,str[5],f64) → Map(nom,Arena&[8] memory,u64 size,str[5],f64)
Map(Stack&[1] memory,u64 size,str[5],i64) → Map(nom,Stack&[1] memory,u64 size,str[5],i64)
Map(Volatile&[9] memory,u64 size,str[5],i64) → Map(nom,Volatile&[9] memory,u64 size,str[5],i64)
Map(Volatile&[9] memory,u64 size,str[5],i64) → Map(nom,Volatile&[9] memory,u64 size,str[5],i64)
Map(Arena&[8] memory,u64 size,str[5],i64) → Map(nom,Arena&[8] memory,u64 size,str[5],i64)
Map(Arena&[8] memory,u64 size,u64,i64) → Map(nom,Arena&[8] memory,u64 size,u64,i64)
Map(Stack&[1] memory,u64 size,u64,i64) → Map(nom,Stack&[1] memory,u64 size,u64,i64)
Map(nom,Stack&[1] memory,u64 size,str[5],f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Stack[1] memory)
Map(Stack&[1] memory,u64 size,u64,str[5]) → Map(nom,Stack&[1] memory,u64 size,u64,str[5])
Map(nom,Volatile&[9] memory,u64 size,str[5],f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(Volatile&[9] memory,u64 size,str[5],str[5]) → Map(nom,Volatile&[9] memory,u64 size,str[5],str[5])
Map(Stack&[1] memory,u64 size,u64,f64) → Map(nom,Stack&[1] memory,u64 size,u64,f64)
Map(nom,Arena&[8] memory,u64 size,u64,str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(nom,Arena&[8] memory,u64 size,str[5],f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(nom,Volatile&[9] memory,u64 size,str[5],f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(nom,Arena&[8] memory,u64 size,str[5],f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(nom,Dynamic&[4] memory,u64 size,str[5],f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Dynamic[4] memory)
Map(nom,Stack&[1] memory,u64 size,u64,str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Stack[1] memory)
Map(nom,Heap&[1] memory,u64 size,u64,f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Heap[1] memory)
Map(Volatile&[9] memory,u64 size,u64,u64) → Map(nom,Volatile&[9] memory,u64 size,u64,u64)
Map(nom,Volatile&[9] memory,u64 size,u64,i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(nom,Heap&[1] memory,u64 size,str[5],str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Heap[1] memory)
Map(nom,Arena&[8] memory,u64 size,u64,f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(nom,Volatile&[9] memory,u64 size,u64,f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(nom,Volatile&[9] memory,u64 size,u64,i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(Stack&[1] memory,u64 size,str[5],f64) → Map(nom,Stack&[1] memory,u64 size,str[5],f64)
Map(nom,Stack&[1] memory,u64 size,str[5],i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Stack[1] memory)
Map(Volatile&[9] memory,u64 size,str[5],f64) → Map(nom,Volatile&[9] memory,u64 size,str[5],f64)
Map(nom,Heap&[1] memory,u64 size,u64,u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Heap[1] memory)
Map(nom,Volatile&[9] memory,u64 size,u64,str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(nom,Dynamic&[4] memory,u64 size,str[5],str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Dynamic[4] memory)
Map(nom,Arena&[8] memory,u64 size,str[5],str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(nom,Heap&[1] memory,u64 size,str[5],i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Heap[1] memory)
Map(nom,Heap&[1] memory,u64 size,str[5],f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Heap[1] memory)
Map(nom,Arena&[8] memory,u64 size,u64,i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(nom,Arena&[8] memory,u64 size,u64,i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(Heap&[1] memory,u64 size,u64,u64) → Map(nom,Heap&[1] memory,u64 size,u64,u64)
Map(nom,Dynamic&[4] memory,u64 size,u64,u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Dynamic[4] memory)
Map(nom,Arena&[8] memory,u64 size,str[5],i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(Dynamic&[4] memory,u64 size,u64,str[5]) → Map(nom,Dynamic&[4] memory,u64 size,u64,str[5])
Map(nom,Volatile&[9] memory,u64 size,str[5],str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(nom,Stack&[1] memory,u64 size,u64,f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Stack[1] memory)
Map(Heap&[1] memory,u64 size,u64,f64) → Map(nom,Heap&[1] memory,u64 size,u64,f64)
Map(nom,Stack&[1] memory,u64 size,u64,i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Stack[1] memory)
Map(nom,Volatile&[9] memory,u64 size,str[5],i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(Dynamic&[4] memory,u64 size,str[5],i64) → Map(nom,Dynamic&[4] memory,u64 size,str[5],i64)
Map(nom,Dynamic&[4] memory,u64 size,u64,str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Dynamic[4] memory)
Map(nom,Arena&[8] memory,u64 size,u64,u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(Arena&[8] memory,u64 size,str[5],f64) → Map(nom,Arena&[8] memory,u64 size,str[5],f64)
Map(nom,Dynamic&[4] memory,u64 size,u64,f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Dynamic[4] memory)
Map(Dynamic&[4] memory,u64 size,u64,i64) → Map(nom,Dynamic&[4] memory,u64 size,u64,i64)
Map(nom,Arena&[8] memory,u64 size,str[5],u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(nom,Volatile&[9] memory,u64 size,u64,f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(nom,Heap&[1] memory,u64 size,u64,i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Heap[1] memory)
Map(Arena&[8] memory,u64 size,u64,u64) → Map(nom,Arena&[8] memory,u64 size,u64,u64)
Map(nom,Volatile&[9] memory,u64 size,u64,u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(nom,Dynamic&[4] memory,u64 size,str[5],i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Dynamic[4] memory)
Map(Arena&[8] memory,u64 size,u64,f64) → Map(nom,Arena&[8] memory,u64 size,u64,f64)
Map(nom,Volatile&[9] memory,u64 size,str[5],i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(nom,Arena&[8] memory,u64 size,str[5],i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(nom,Stack&[1] memory,u64 size,u64,u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Stack[1] memory)
Map(nom,Dynamic&[4] memory,u64 size,u64,i64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Dynamic[4] memory)
Map(nom,Arena&[8] memory,u64 size,str[5],u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(Heap&[1] memory,u64 size,str[5],u64) → Map(nom,Heap&[1] memory,u64 size,str[5],u64)
Map(nom,Arena&[8] memory,u64 size,u64,u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(nom,Heap&[1] memory,u64 size,str[5],u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Heap[1] memory)
Map(nom,Volatile&[9] memory,u64 size,u64,u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(nom,Volatile&[9] memory,u64 size,str[5],u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(Heap&[1] memory,u64 size,str[5],f64) → Map(nom,Heap&[1] memory,u64 size,str[5],f64)
Map(Heap&[1] memory,u64 size,str[5],i64) → Map(nom,Heap&[1] memory,u64 size,str[5],i64)
Map(nom,Volatile&[9] memory,u64 size,u64,str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(nom,Heap&[1] memory,u64 size,u64,str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Heap[1] memory)
Map(nom,Stack&[1] memory,u64 size,str[5],u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Stack[1] memory)
Map(Arena&[8] memory,u64 size,u64,str[5]) → Map(nom,Arena&[8] memory,u64 size,u64,str[5])
Map(Heap&[1] memory,u64 size,u64,i64) → Map(nom,Heap&[1] memory,u64 size,u64,i64)
Map(nom,Dynamic&[4] memory,u64 size,str[5],u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Dynamic[4] memory)
Map(nom,Arena&[8] memory,u64 size,u64,str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(Volatile&[9] memory,u64 size,str[5],u64) → Map(nom,Volatile&[9] memory,u64 size,str[5],u64)
Map(nom,Volatile&[9] memory,u64 size,str[5],str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(nom,Arena&[8] memory,u64 size,u64,f64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(nom,Stack&[1] memory,u64 size,str[5],str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Stack[1] memory)
Map(Arena&[8] memory,u64 size,u64,f64) → Map(nom,Arena&[8] memory,u64 size,u64,f64)
Map(nom,Volatile&[9] memory,u64 size,str[5],u64) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Volatile[9] memory)
Map(Volatile&[9] memory,u64 size,u64,i64) → Map(nom,Volatile&[9] memory,u64 size,u64,i64)
Map(Arena&[8] memory,u64 size,str[5],u64) → Map(nom,Arena&[8] memory,u64 size,str[5],u64)
Map(nom,Arena&[8] memory,u64 size,str[5],str[5]) → (nom,u64 size,ContiguousMemory[6] mem,u64 length,Arena[8] memory)
Map(Arena&[8] memory,u64 size,u64,i64) → Map(nom,Arena&[8] memory,u64 size,u64,i64)
Map(Volatile&[9] memory,u64 size,u64,i64) → Map(nom,Volatile&[9] memory,u64 size,u64,i64)
has
Checks if an element key exists in a Map.
has(Map[10] self,str[5] _key) → bool
has(Map[18] self,str[5] _key) → bool
has(Map[10] self,str[5] _key) → bool
has(Map[17] self,str[5] _key) → bool
has(Map[18] self,str[5] _key) → bool
has(Map[17] self,str[5] _key) → bool
has(Map[13] self,str[5] _key) → bool
has(Map[18] self,str[5] _key) → bool
has(Map[17] self,str[5] _key) → bool
has(Map[17] self,str[5] _key) → bool
has(Map[18] self,str[5] _key) → bool
has(Map[10] self,str[5] _key) → bool
has(Map[13] self,str[5] _key) → bool
has(Map[10] self,str[5] _key) → bool
has(Map[17] self,str[5] _key) → bool
has(Map[18] self,str[5] _key) → bool
has(Map[17] self,str[5] _key) → bool
has(Map[18] self,str[5] _key) → bool
has(Map[18] self,u64 _key) → bool
has(Map[10] self,str[5] _key) → bool
has(Map[10] self,str[5] _key) → bool
has(Map[13] self,u64 _key) → bool
has(Map[10] self,u64 _key) → bool
has(Map[10] self,u64 _key) → bool
has(Map[18] self,u64 _key) → bool
has(Map[10] self,u64 _key) → bool
has(Map[17] self,u64 _key) → bool
has(Map[17] self,u64 _key) → bool
has(Map[17] self,u64 _key) → bool
has(Map[10] self,u64 _key) → bool
has(Map[17] self,u64 _key) → bool
has(Map[18] self,u64 _key) → bool
has(Map[18] self,str[5] _key) → bool
has(Map[17] self,str[5] _key) → bool
has(Map[18] self,u64 _key) → bool
has(Map[10] self,u64 _key) → bool
has(Map[17] self,u64 _key) → bool
has(Map[18] self,str[5] _key) → bool
has(Map[17] self,u64 _key) → bool
has(Map[18] self,u64 _key) → bool
has(Map[10] self,str[5] _key) → bool
has(Map[10] self,u64 _key) → bool
has(Map[10] self,u64 _key) → bool
has(Map[13] self,u64 _key) → bool
has(Map[10] self,u64 _key) → bool
has(Map[18] self,u64 _key) → bool
has(Map[13] self,u64 _key) → bool
has(Map[13] self,str[5] _key) → bool
has(Map[17] self,str[5] _key) → bool
has(Map[13] self,str[5] _key) → bool
has(Map[18] self,u64 _key) → bool
has(Map[13] self,u64 _key) → bool
has(Map[17] self,u64 _key) → bool
has(Map[10] self,str[5] _key) → bool
has(Map[18] self,u64 _key) → bool
has(Map[17] self,u64 _key) → bool
put
Computes hash values for several primitive and string types to be used by maps.
put(Map&[17] self,str[5] _key,cstr _mval) → ()
put(Map&[18] self,str[5] _key,cstr _mval) → ()
put(Map&[17] self,str[5] _key,cstr _mval) → ()
put(Map&[13] self,str[5] _key,cstr _mval) → ()
put(Map&[10] self,u64 _key,cstr _mval) → ()
put(Map&[13] self,u64 _key,cstr _mval) → ()
put(Map&[17] self,u64 _key,cstr _mval) → ()
put(Map&[17] self,cstr _mkey,cstr _mval) → ()
put(Map&[10] self,cstr _mkey,cstr _mval) → ()
put(Map&[10] self,cstr _mkey,cstr _mval) → ()
put(Map&[18] self,cstr _mkey,str[5] _val) → ()
put(Map&[18] self,cstr _mkey,str[5] _val) → ()
put(Map&[17] self,cstr _mkey,str[5] _val) → ()
put(Map&[10] self,cstr _mkey,str[5] _val) → ()
put(Map&[13] self,cstr _mkey,u64 _val) → ()
put(Map&[13] self,cstr _mkey,str[5] _val) → ()
put(Map&[18] self,cstr _mkey,u64 _val) → ()
put(Map&[17] self,cstr _mkey,u64 _val) → ()
put(Map&[13] self,cstr _mkey,f64 _val) → ()
put(Map&[17] self,cstr _mkey,f64 _val) → ()
put(Map&[18] self,cstr _mkey,f64 _val) → ()
put(Map&[18] self,cstr _mkey,f64 _val) → ()
put(Map&[13] self,cstr _mkey,i64 _val) → ()
put(Map&[17] self,cstr _mkey,str[5] _val) → ()
put(Map&[17] self,str[5] _key,str[5] _val) → ()
put(Map&[18] self,str[5] _key,f64 _val) → ()
put(Map&[10] self,str[5] _key,cstr _mval) → ()
put(Map&[18] self,u64 _key,cstr _mval) → ()
put(Map&[18] self,str[5] _key,i64 _val) → ()
put(Map&[13] self,u64 _key,i64 _val) → ()
put(Map&[17] self,u64 _key,f64 _val) → ()
put(Map&[10] self,cstr _mkey,f64 _val) → ()
put(Map&[18] self,u64 _key,f64 _val) → ()
put(Map&[10] self,str[5] _key,f64 _val) → ()
put(Map&[17] self,str[5] _key,u64 _val) → ()
put(Map&[17] self,cstr _mkey,i64 _val) → ()
put(Map&[18] self,u64 _key,f64 _val) → ()
put(Map&[17] self,str[5] _key,i64 _val) → ()
put(Map&[10] self,str[5] _key,i64 _val) → ()
put(Map&[17] self,str[5] _key,f64 _val) → ()
put(Map&[18] self,u64 _key,i64 _val) → ()
put(Map&[18] self,cstr _mkey,cstr _mval) → ()
put(Map&[10] self,cstr _mkey,u64 _val) → ()
put(Map&[17] self,u64 _key,i64 _val) → ()
put(Map&[10] self,u64 _key,i64 _val) → ()
put(Map&[10] self,str[5] _key,cstr _mval) → ()
put(Map&[17] self,cstr _mkey,u64 _val) → ()
put(Map&[18] self,u64 _key,u64 _val) → ()
put(Map&[18] self,cstr _mkey,u64 _val) → ()
put(Map&[17] self,u64 _key,f64 _val) → ()
put(Map&[10] self,u64 _key,cstr _mval) → ()
put(Map&[17] self,u64 _key,i64 _val) → ()
put(Map&[10] self,u64 _key,i64 _val) → ()
put(Map&[18] self,u64 _key,i64 _val) → ()
put(Map&[10] self,u64 _key,u64 _val) → ()
put(Map&[17] self,cstr _mkey,cstr _mval) → ()
put(Map&[17] self,str[5] _key,f64 _val) → ()
put(Map&[10] self,str[5] _key,u64 _val) → ()
put(Map&[10] self,str[5] _key,f64 _val) → ()
put(Map&[13] self,str[5] _key,f64 _val) → ()
put(Map&[18] self,str[5] _key,u64 _val) → ()
put(Map&[18] self,str[5] _key,i64 _val) → ()
put(Map&[10] self,u64 _key,f64 _val) → ()
put(Map&[17] self,cstr _mkey,i64 _val) → ()
put(Map&[10] self,u64 _key,str[5] _val) → ()
put(Map&[13] self,u64 _key,f64 _val) → ()
put(Map&[10] self,cstr _mkey,f64 _val) → ()
put(Map&[18] self,str[5] _key,str[5] _val) → ()
put(Map&[13] self,cstr _mkey,cstr _mval) → ()
put(Map&[10] self,str[5] _key,i64 _val) → ()
put(Map&[10] self,u64 _key,f64 _val) → ()
put(Map&[17] self,u64 _key,cstr _mval) → ()
put(Map&[18] self,u64 _key,cstr _mval) → ()
put(Map&[17] self,str[5] _key,u64 _val) → ()
put(Map&[17] self,str[5] _key,i64 _val) → ()
put(Map&[13] self,str[5] _key,i64 _val) → ()
put(Map&[17] self,u64 _key,str[5] _val) → ()
put(Map&[13] self,str[5] _key,str[5] _val) → ()
put(Map&[13] self,u64 _key,u64 _val) → ()
put(Map&[10] self,str[5] _key,u64 _val) → ()
put(Map&[10] self,u64 _key,u64 _val) → ()
put(Map&[13] self,str[5] _key,u64 _val) → ()
put(Map&[18] self,cstr _mkey,cstr _mval) → ()
put(Map&[17] self,u64 _key,u64 _val) → ()
put(Map&[18] self,u64 _key,u64 _val) → ()
put(Map&[17] self,cstr _mkey,f64 _val) → ()
put(Map&[18] self,cstr _mkey,i64 _val) → ()
put(Map&[17] self,u64 _key,u64 _val) → ()
put(Map&[18] self,cstr _mkey,i64 _val) → ()
put(Map&[18] self,u64 _key,str[5] _val) → ()
put(Map&[18] self,str[5] _key,u64 _val) → ()
put(Map&[17] self,u64 _key,str[5] _val) → ()
put(Map&[10] self,u64 _key,str[5] _val) → ()
put(Map&[10] self,cstr _mkey,i64 _val) → ()
put(Map&[18] self,str[5] _key,cstr _mval) → ()
put(Map&[10] self,cstr _mkey,str[5] _val) → ()
put(Map&[18] self,u64 _key,str[5] _val) → ()
put(Map&[18] self,str[5] _key,f64 _val) → ()
put(Map&[10] self,str[5] _key,str[5] _val) → ()
put(Map&[17] self,str[5] _key,str[5] _val) → ()
put(Map&[13] self,u64 _key,str[5] _val) → ()
put(Map&[18] self,str[5] _key,str[5] _val) → ()
put(Map&[10] self,cstr _mkey,u64 _val) → ()
put(Map&[10] self,str[5] _key,str[5] _val) → ()
put(Map&[10] self,cstr _mkey,i64 _val) → ()
std.math unsafe
Standard library wrapping of C math operations.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
cos
cos(f64 x) → f64
acos
acos(f64 x) → f64
sin
sin(f64 x) → f64
asin
asin(f64 x) → f64
exp
exp(f64 x) → f64
pi
pi(f64 x) → f64
tan
tan(f64 x) → f64
atan
atan(f64 x) → f64
atan2
atan2(f64 y,f64 x) → f64
is_nan
is_nan(f64 x) → bool
is_inf
is_inf(f64 x) → bool
sqrt
sqrt(f64 x) → f64
pow
pow(f64 base,f64 exponent) → f64
log
log(f64 x) → f64
std.mem
std/mem.s
std.mem.allocate unsafe
Standard library implementation of memory management that accounts for the stack and heap and depends on GCC implementations of malloc and alloca. Stack alloactions cannot be returned from services, as the stack is pruned when programming function calls end. Smo runtypes are not implemented as functions, so it is fine to return stack allocations from them.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
Stack
Represents call stack memory. Allocating on this is near-zero cost by being just an arithmetic addition but its total size is limited - typically up to a few megabytes. Prefer this for small localized data that need to be processed exceedingly fast.
Stack(nom) → nom
Heap
Random access memory (RAM) that can be allocated with malloc. Writing to it and reading from it can be slow for programs that keep. Modern processors optimize heap usage by prefetching and caching nearby areas as the ones you access. For this reason, prefer creating Arena regions when you have a sense of the exact amount of data you will need. Allocating on the heap can leak memory under certain conditions, but the lnaguage's safety mechanism prevents this. Use other allocators in those cases. The standard library provides a Dynamic type that also accesses several heap allocations, though with an additional level of indirection.
Heap(nom) → nom
MemoryDevice
Refers to either stack or heap memory.
Heap(nom) → nom
Stack(nom) → nom
is
is(u64 value,u64) → ()
is(f64 value,f64) → ()
is(Stack[1],Stack[1]) → ()
is(char value,char) → ()
is(i64 value,i64) → ()
is(Heap[1],Heap[1]) → ()
ContiguousMemory
Represents allocated memory management. It keeps track of both currently used pointer addresses, for example if these are offsets of allocated base pointers with finally segments calling free on those, and the underlying pointer addresses. Importantly, not all this information is retained after compilation, as most of it -perhaps all- is optimized away. But this structure still helps the compiler organize where to place memory releases, if needed. Users of the standard library will not generally work with this type, as it is highly unsafe to get its pointer fields and requires annotation for the language to allow that.
ContiguousMemory(nom,Stack[1],u64 size,char,ptr mem,ptr underlying) → (nom,Stack[1],u64 size,char,ptr mem,ptr underlying)
ContiguousMemory(nom,Stack[1],u64 size,u64,ptr mem,ptr underlying) → (nom,Stack[1],u64 size,u64,ptr mem,ptr underlying)
ContiguousMemory(nom,Heap[1],u64 size,u64,ptr mem,ptr underlying) → (nom,Heap[1],u64 size,u64,ptr mem,ptr underlying)
ContiguousMemory(nom,Heap[1],u64 size,f64,ptr mem,ptr underlying) → (nom,Heap[1],u64 size,f64,ptr mem,ptr underlying)
ContiguousMemory(nom,Stack[1],u64 size,f64,ptr mem,ptr underlying) → (nom,Stack[1],u64 size,f64,ptr mem,ptr underlying)
ContiguousMemory(nom,Stack[1],u64 size,i64,ptr mem,ptr underlying) → (nom,Stack[1],u64 size,i64,ptr mem,ptr underlying)
ContiguousMemory(nom,Heap[1],u64 size,char,ptr mem,ptr underlying) → (nom,Heap[1],u64 size,char,ptr mem,ptr underlying)
ContiguousMemory(nom,Heap[1],u64 size,i64,ptr mem,ptr underlying) → (nom,Heap[1],u64 size,i64,ptr mem,ptr underlying)
allocate
Allocates memory on a predetermined device given a number of entries and an optional primitive data type. If the data type is not provided, char is assumed so that the number of entries becomes equal to the number of allocated bytes. Other standard library overloads implement allocation for more memory types, derived from the devices. Allocations throughout the standard library track the raw allocated memory so that usage is finally released only when the last dependent variable (e.g., the last string allocated on a heap arena) is no longer used. See ContiguousMemory.
allocate(Heap[1],u64 size,u64) → ContiguousMemory[6]
allocate(Heap[1],u64 size) → ContiguousMemory[6]
allocate(Stack[1],u64 size,char) → ContiguousMemory[6]
allocate(Heap[1],u64 size,f64) → ContiguousMemory[6]
allocate(Heap[1],u64 size,i64) → ContiguousMemory[6]
allocate(Stack[1],u64 size,u64) → ContiguousMemory[6]
allocate(Stack[1],u64 size) → ContiguousMemory[6]
allocate(Stack[1],u64 size,f64) → ContiguousMemory[6]
allocate(Stack[1],u64 size,i64) → ContiguousMemory[6]
allocate(Heap[1],u64 size,char) → ContiguousMemory[6]
__unsafe_put
Can modify an allocated memory. This operation is marked as unsafe and cannot be callsed in safe files.
__unsafe_put(ContiguousMemory[6] v,u64 pos,char value) → (ContiguousMemory[6] v)
__unsafe_put(ContiguousMemory[6] v,u64 pos,u64 value) → (ContiguousMemory[6] v)
__unsafe_put(ContiguousMemory[6] v,u64 pos,f64 value) → (ContiguousMemory[6] v)
__unsafe_put(ContiguousMemory[6] v,u64 pos,f64 value) → (ContiguousMemory[6] v)
__unsafe_put(ContiguousMemory[6] v,u64 pos,char value) → (ContiguousMemory[6] v)
__unsafe_put(ContiguousMemory[6] v,u64 pos,u64 value) → (ContiguousMemory[6] v)
__unsafe_put(ContiguousMemory[6] v,u64 pos,i64 value) → (ContiguousMemory[6] v)
__unsafe_put(ContiguousMemory[6] v,u64 pos,i64 value) → (ContiguousMemory[6] v)
at
Accesses a specific memory position of the corresponding base type. This operation includes bound checks.
at(ContiguousMemory[6] v,u64 pos) → i64
at(ContiguousMemory[6] v,u64 pos) → u64
at(ContiguousMemory[6] v,u64 pos) → f64
at(ContiguousMemory[6] v,u64 pos) → char
at(ContiguousMemory[6] v,u64 pos) → u64
at(ContiguousMemory[6] v,u64 pos) → char
at(ContiguousMemory[6] v,u64 pos) → i64
at(ContiguousMemory[6] v,u64 pos) → f64
std.mem.arena unsafe
Standard library implementation of arena allocation, marked as @noborrow but unsafely returned from constructors. Pointer arithmetics yield offsets within arenas.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
Dynamic
Dynamic(nom) → (nom,ptr acquired,u64 size,u64 allocated)
Arena
Arena(nom,ContiguousMemory[6] contents) → (nom,ContiguousMemory[6] contents,u64 length)
Arena(nom,ContiguousMemory[6] contents) → (nom,ContiguousMemory[6] contents,u64 length)
read
read(Arena&[8] self) → str[5]
read(Arena&[8] self) → str[5]
Volatile
Volatile(nom,ContiguousMemory[6] contents) → (nom,ContiguousMemory[6] contents,u64 length,u64 cycles)
Volatile(nom,ContiguousMemory[6] contents) → (nom,ContiguousMemory[6] contents,u64 length,u64 cycles)
is
is(Dynamic&[4],Dynamic&[4]) → ()
is(Volatile&[9],Volatile&[9]) → ()
is(Arena&[8],Arena&[8]) → ()
is(Arena&[8],Arena&[8]) → ()
is(Volatile&[9],Volatile&[9]) → ()
controlled_corrupt
controlled_corrupt(Volatile&[9] self) → ()
controlled_corrupt(Volatile&[9] self) → ()
DerivedMemory
Volatile(nom,ContiguousMemory[6] contents) → (nom,ContiguousMemory[6] contents,u64 length,u64 cycles)
Volatile(nom,ContiguousMemory[6] contents) → (nom,ContiguousMemory[6] contents,u64 length,u64 cycles)
Arena(nom,ContiguousMemory[6] contents) → (nom,ContiguousMemory[6] contents,u64 length)
Arena(nom,ContiguousMemory[6] contents) → (nom,ContiguousMemory[6] contents,u64 length)
allocate
allocate(Volatile&[9] self,u64 _size,char) → ContiguousMemory[6]
allocate(Volatile&[9] self,u64 _size,u64) → ContiguousMemory[6]
allocate(Volatile&[9] self,u64 _size,f64) → ContiguousMemory[6]
allocate(Volatile&[9] self,u64 _size,f64) → ContiguousMemory[6]
allocate(Dynamic&[4] self,u64 size,u64) → ContiguousMemory[6]
allocate(Volatile&[9] self,u64 _size,i64) → ContiguousMemory[6]
allocate(Dynamic&[4] self,u64 size,f64) → ContiguousMemory[6]
allocate(Dynamic&[4] self,u64 size,i64) → ContiguousMemory[6]
allocate(Dynamic&[4] self,u64 size,char) → ContiguousMemory[6]
allocate(Volatile&[9] self,u64 _size,u64) → ContiguousMemory[6]
allocate(Volatile&[9] self,u64 size) → ContiguousMemory[6]
allocate(Arena&[8] self,u64 size) → ContiguousMemory[6]
allocate(Arena&[8] self,u64 _size,f64) → ContiguousMemory[6]
allocate(Volatile&[9] self,u64 size) → ContiguousMemory[6]
allocate(Arena&[8] self,u64 _size,i64) → ContiguousMemory[6]
allocate(Arena&[8] self,u64 _size,i64) → ContiguousMemory[6]
allocate(Arena&[8] self,u64 _size,f64) → ContiguousMemory[6]
allocate(Arena&[8] self,u64 _size,u64) → ContiguousMemory[6]
allocate(Volatile&[9] self,u64 _size,char) → ContiguousMemory[6]
allocate(Arena&[8] self,u64 _size,u64) → ContiguousMemory[6]
allocate(Arena&[8] self,u64 _size,char) → ContiguousMemory[6]
allocate(Arena&[8] self,u64 size) → ContiguousMemory[6]
allocate(Dynamic&[4] self,u64 size) → ContiguousMemory[6]
allocate(Arena&[8] self,u64 _size,char) → ContiguousMemory[6]
allocate(Volatile&[9] self,u64 _size,i64) → ContiguousMemory[6]
reserved
reserved(Arena&[8] self) → u64
reserved(Arena&[8] self) → u64
reserved(Volatile&[9] self) → u64
reserved(Volatile&[9] self) → u64
_arena
_arena(ContiguousMemory[6] mem) → Arena[7]
_arena(ContiguousMemory[6] mem) → Arena[7]
_volatile
_volatile(ContiguousMemory[6] mem) → Volatile[7]
_volatile(ContiguousMemory[6] mem) → Volatile[7]
len
len(Volatile&[9] self) → u64
len(Arena&[8] self) → u64
len(Arena&[8] self) → u64
len(Volatile&[9] self) → u64
allocate_arena
allocate_arena(Dynamic&[4] self,u64 size) → Arena[7]
allocate_arena(Volatile&[9] self,u64 size) → Arena[7]
allocate_arena(Volatile&[9] self,u64 size) → Arena[7]
allocate_arena(Arena&[8] self,u64 size) → Arena[7]
allocate_arena(Arena&[8] self,u64 size) → Arena[7]
allocate_arena(Stack[1],u64 size) → Arena[7]
allocate_arena(Heap[1],u64 size) → Arena[7]
allocate_volatile
allocate_volatile(Dynamic&[4] self,u64 size) → Volatile[7]
allocate_volatile(Volatile&[9] self,u64 size) → Volatile[7]
allocate_volatile(Arena&[8] self,u64 size) → Volatile[7]
allocate_volatile(Volatile&[9] self,u64 size) → Volatile[7]
allocate_volatile(Arena&[8] self,u64 size) → Volatile[7]
allocate_volatile(Stack[1],u64 size) → Volatile[7]
allocate_volatile(Heap[1],u64 size) → Volatile[7]
Memory
Arena(nom,ContiguousMemory[6] contents) → (nom,ContiguousMemory[6] contents,u64 length)
Volatile(nom,ContiguousMemory[6] contents) → (nom,ContiguousMemory[6] contents,u64 length,u64 cycles)
Volatile(nom,ContiguousMemory[6] contents) → (nom,ContiguousMemory[6] contents,u64 length,u64 cycles)
Dynamic(nom) → (nom,ptr acquired,u64 size,u64 allocated)
Arena(nom,ContiguousMemory[6] contents) → (nom,ContiguousMemory[6] contents,u64 length)
std.mem.str unsafe
Standard library implementation of string operations using its own allocators and C memory operations.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
copy
copy(Heap&[1] allocator,str[5] _s) → str[5]
copy(Arena&[8] allocator,str[5] _s) → str[5]
copy(Dynamic&[4] allocator,str[5] _s) → str[5]
copy(Stack&[1] allocator,str[5] _s) → str[5]
copy(Volatile&[9] allocator,str[5] _s) → str[5]
copy(Volatile&[9] allocator,str[5] _s) → str[5]
copy(Arena&[8] allocator,str[5] _s) → str[5]
tostr
tostr(Heap&[1] allocator,f64 number) → (str[5])
tostr(Dynamic&[4] allocator,f64 number) → (str[5])
tostr(Stack&[1] allocator,f64 number) → (str[5])
tostr(Volatile&[9] allocator,f64 number) → (str[5])
tostr(Arena&[8] allocator,f64 number) → (str[5])
tostr(Volatile&[9] allocator,f64 number) → (str[5])
tostr(Heap&[1] allocator,u64 number) → str[5]
tostr(Arena&[8] allocator,i64 number) → str[5]
tostr(Volatile&[9] allocator,i64 number) → str[5]
tostr(Stack&[1] allocator,i64 number) → str[5]
tostr(Arena&[8] allocator,i64 number) → str[5]
tostr(Dynamic&[4] allocator,i64 number) → str[5]
tostr(Dynamic&[4] allocator,u64 number) → str[5]
tostr(Heap&[1] allocator,i64 number) → str[5]
tostr(Volatile&[9] allocator,u64 number) → str[5]
tostr(Arena&[8] allocator,u64 number) → str[5]
tostr(Arena&[8] allocator,f64 number) → (str[5])
tostr(Volatile&[9] allocator,u64 number) → str[5]
tostr(Stack&[1] allocator,u64 number) → str[5]
tostr(Volatile&[9] allocator,i64 number) → str[5]
tostr(Arena&[8] allocator,u64 number) → str[5]
add
add(Volatile&[9] allocator,cstr x,str[5] y) → str[5]
add(Arena&[8] allocator,str[5] x,cstr y) → str[5]
add(Volatile&[9] allocator,str[5] x,cstr y) → str[5]
add(Heap&[1] allocator,str[5] x,str[5] y) → str[5]
add(Volatile&[9] allocator,str[5] x,cstr y) → str[5]
add(Heap&[1] allocator,str[5] x,cstr y) → str[5]
add(Arena&[8] allocator,cstr x,str[5] y) → str[5]
add(Arena&[8] allocator,str[5] x,str[5] y) → str[5]
add(Stack&[1] allocator,str[5] x,str[5] y) → str[5]
add(Volatile&[9] allocator,str[5] x,str[5] y) → str[5]
add(Volatile&[9] allocator,str[5] x,str[5] y) → str[5]
add(Arena&[8] allocator,str[5] x,str[5] y) → str[5]
add(Stack&[1] allocator,cstr x,str[5] y) → str[5]
add(Arena&[8] allocator,str[5] x,cstr y) → str[5]
add(Dynamic&[4] allocator,str[5] x,str[5] y) → str[5]
add(Stack&[1] allocator,str[5] x,cstr y) → str[5]
add(Dynamic&[4] allocator,str[5] x,cstr y) → str[5]
add(Volatile&[9] allocator,cstr x,str[5] y) → str[5]
add(Arena&[8] allocator,cstr x,str[5] y) → str[5]
add(Dynamic&[4] allocator,cstr x,str[5] y) → str[5]
add(Heap&[1] allocator,cstr x,str[5] y) → str[5]
std.os unsafe
Standard library wrapping of C system calls.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
system
system(str[5] command) → ()
system(cstr command) → ()
std.rand unsafe
Standard library porting Xoshiro256plusInitializer random numbers from https://prng.di.unimi.it/. These and are NOT cryptographically secure.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
__rotl
__rotl(u64 x,u64 k) → u64
__splitmix64
__splitmix64(u64& x) → u64
next
next(u64& self.s0,u64& self.s1,u64& self.s2,u64& self.s3) → f64
Rand
This a structural type for storing the progress of random number generators on four u64 state fields. It can be initialized with an optional seed, which defaults to a time-based initialization if not provided. For safety against sharing random implementations between services or repeatedly initializating them, state variables are marked as a leaking resource. The whole data type as a whole is marked as @noborrow. These safety mechanisms are not mandatory but help safeguard speed by preventing common mistakes, such as directly re-initializing Rand in each loop to get a next number.
Rand() → Rand(u64 seed)
Rand(u64 seed) → (u64 s0,u64 s1,u64 s2,u64 s3)
std.time unsafe
Standard library wrapping of C++ chrono time.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
time
time() → f64
std.vec unsafe
Standard library implementation of vectors allocated with its memory management but using C pointers for element access.
This file is marked with the unsafe keyword. This means that its internal implementation (only) could be subject to bugs that the language's design otherwise eliminates. By using this file as a direct or indirect dependency you are trusting its implementation. Given this trust, consider other non-unsafe files using it as safe.
Vec
Vec(nom,ptr contents,u64 size,ptr surface) → (nom,ptr contents,u64 size,ptr surface)
dot
dot(Vec[4] x1,Vec[4] x2) → f64
allocate_vector
allocate_vector(u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,Heap&[1] memory,u64 size) → Vec[4]
allocate_vector(u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,Dynamic&[4] memory,u64 size) → Vec[4]
allocate_vector(u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,Stack&[1] memory,u64 size) → Vec[4]
allocate_vector(u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,Volatile&[9] memory,u64 size) → Vec[4]
allocate_vector(u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,Volatile&[9] memory,u64 size) → Vec[4]
allocate_vector(u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,Arena&[8] memory,u64 size) → Vec[4]
allocate_vector(Volatile&[9] memory,u64 size) → Vec[4]
allocate_vector(Heap&[1] memory,u64 size) → Vec[4]
allocate_vector(Volatile&[9] memory,u64 size) → Vec[4]
allocate_vector(Arena&[8] memory,u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,u64 size) → Vec[4]
allocate_vector(Arena&[8] memory,u64 size) → Vec[4]
allocate_vector(Stack&[1] memory,u64 size) → Vec[4]
allocate_vector(Dynamic&[4] memory,u64 size) → Vec[4]
allocate_vector(Heap&[1] memory,u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,u64 size) → Vec[4]
allocate_vector(Arena&[8] memory,u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,u64 size) → Vec[4]
allocate_vector(Volatile&[9] memory,u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,u64 size) → Vec[4]
allocate_vector(Dynamic&[4] memory,u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,u64 size) → Vec[4]
allocate_vector(Arena&[8] memory,u64 size) → Vec[4]
allocate_vector(Volatile&[9] memory,u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,u64 size) → Vec[4]
allocate_vector(u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,Arena&[8] memory,u64 size) → Vec[4]
allocate_vector(Stack&[1] memory,u64& rand.s0,u64& rand.s1,u64& rand.s2,u64& rand.s3,u64 size) → Vec[4]
print
print(Vec[4] v) → ()
slice
slice(Vec[4] v,u64 from,u64 to) → Vec[4]
set
set(Vec&[4] x1,Vec[4] x2) → ()
set(Vec&[4] v,u64 pos,f64 value) → Vec[4]
len
len(Vec[4] v) → u64
at
at(Vec[4] v,u64 pos) → f64
add
add(Vec&[4] result,Vec[4] x1,Vec[4] x2) → Vec[4]
add(Heap&[1] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
add(Arena&[8] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
add(Stack&[1] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
add(Dynamic&[4] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
add(Volatile&[9] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
add(Arena&[8] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
add(Volatile&[9] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
sub
sub(Heap&[1] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
sub(Arena&[8] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
sub(Stack&[1] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
sub(Volatile&[9] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
sub(Dynamic&[4] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
sub(Volatile&[9] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
sub(Arena&[8] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
sub(Vec&[4] result,Vec[4] x1,Vec[4] x2) → Vec[4]
mul
mul(Vec&[4] result,Vec[4] x1,Vec[4] x2) → Vec[4]
mul(Heap&[1] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
mul(Arena&[8] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
mul(Volatile&[9] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
mul(Dynamic&[4] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
mul(Volatile&[9] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
mul(Arena&[8] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
mul(Stack&[1] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
div
div(Vec&[4] result,Vec[4] x1,Vec[4] x2) → Vec[4]
div(Arena&[8] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
div(Heap&[1] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
div(Stack&[1] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
div(Volatile&[9] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
div(Volatile&[9] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
div(Arena&[8] memory,Vec[4] x1,Vec[4] x2) → Vec[4]
div(Dynamic&[4] memory,Vec[4] x1,Vec[4] x2) → Vec[4]