Language level procedure

len

len :: proc(v: Type) -> int

The len built-in procedure return the length of v, according to its type:

Array: the number of elements in v
Pointer to array: the number of elements in v^ (even if v is nil)
Slice: the number of elements in v; if v in nil, len(v) is zero
Dynamic array: the number of elements in v; if v in nil, len(v) is zero
Map: the number of elements in v; if v in nil, len(v) is zero
String: the number of bytes in v

If the parameter passed is an enumeration type, it will return the number of enumeration values:

Foo :: enum {A, B, C};
#assert(len(Foo) == 3);

cap

cap :: proc(v: Type) -> int

The cap built-in procedure return the capacity of v, according to its type:

Dynamic array: the maximum length the dynamic array can reach before it requires a resize; if v in nil, len(v) is zero

size_of

align_of

offset_of

type_of

type_info_of

typeid_of

swizzle

complex

complex :: proc(r, i: Float_Type) -> Complex_Type
``
The `complex` built-in procedure constructs a complex value from two floating-point values. The floating point values must be of the same type and the return value will be the corresponding complex type:

f32 -> complex64 f64 -> complex128


## real

real :: proc(c: ComplexType) -> FloatType ` Therealbuilt-in procedure returns the real component of the complex numberc. The return value will be a floating point that corresponds to the type ofc`:

complex64  -> f32
complex128 -> f64

imag

imag :: proc(c: Complex_Type) -> Float_Type
``
The `imag` built-in procedure returns the imaginary component of the complex number `c`. The return value will be a floating point that corresponds to the type of `c`:

complex64 -> f32 complex128 -> f64

## conj

conj :: proc(c: ComplexType) -> ComplexType ` Theconjbuilt-in procedure complex conjugate of the valuec`.

conj(a + i*b) == a - i*b

expand_to_tuple

min

max

abs

clamp

#location

Runtime level procedures

copy

copy :: proc(dst, src: $T/[]$E) -> int

The copy built-in procedure copies the elements from a source slice to a destination slice. The source and destination are allowed to overlap. copy returns the number of elements that were copied, which is equal to min(len(dst), len(src)).

pop

clear

reserve

append

append_string

new

new :: proc(T: type) -> ^T

The new built-in procedure allocates memory, from the current context's allocator. The first argument is a type, not a value, and the value returned is a pointer to an allocated zero value of that type.

new_clone

new_clone :: proc(v: $T) -> ^T

The new_clone built-in procedure allocates memory, from the current context's allocator. The first argument is a value, not a type, and the value returned is a pointer to an allocated clone of that value passed.

make

make :: proc(T: type, parameters ..Integer_Type) -> T

The make built-in procedure allocates and initializes an object an of type slice, dynamic array, and map. Like new, the first argument is a type, not a value. Unlike new, make's return type is the same as the type of its argument, not a pointer to it.

free

delete

delete_key

incl

incl :: proc(s: ^$S/bit_set[$T, $U], elems: ..$T) -> S

The incl built-in procedure includes elements into a bit set and then returns the original passed bit set. The procedure is equivalent to the following code:

for elem in elems {
    s^ |= {elem};
}

excl

incl :: proc(s: ^$S/bit_set[$T, $U], elems: ..$T) -> S

The incl built-in procedure excludes elements into a bit set and then returns the original passed bit set. The procedure is equivalent to the following code:

for elem in elems {
    s^ &~= {elem};
}

assert

panic