Appendix H: Complete Type Reference¶
This appendix provides detailed information about all types in the language, organized alphabetically.
Primitive Types¶
bool¶
Description: Boolean value representing true or false.
Size: 1 byte
Values: true, false
Default: false
Traits Implemented: Stackable, Equatable, Logical, Stringifiable
Conversions: to_str
Example:
true
false
5 3 > // => true
char¶
Description: Single UTF-8 character.
Size: 4 bytes (Unicode code point)
Values: Any valid Unicode character
Literals: 'A', '\n', '\u{1F600}'
Traits Implemented: Stackable, Equatable, Orderable, Comparable, Stringifiable
Conversions: to_str
Example:
'A'
'😀'
'\n'
f32¶
Description: 32-bit floating point number (IEEE 754 single precision).
Size: 4 bytes
Range: ±1.18e-38 to ±3.40e+38
Precision: ~7 decimal digits
Default: 0.0
Traits Implemented: Stackable, Addable, Multiplyable, Exponentiable, Logarithmic, Math, Orderable, Equatable, Comparable, Number, Convertible, Stringifiable, Parseable
Conversions: to_i8, to_i16, to_i32, to_i64, to_u8, to_u16, to_u32, to_u64, to_f64, to_str
Overflow Behavior: IEEE 754 (infinity/NaN)
Example:
3.14:f32
1.0:f32 2.0:f32 +
f64¶
Description: 64-bit floating point number (IEEE 754 double precision).
Size: 8 bytes
Range: ±2.23e-308 to ±1.80e+308
Precision: ~15 decimal digits
Default: 0.0 (default float type)
Traits Implemented: Stackable, Addable, Multiplyable, Exponentiable, Logarithmic, Math, Orderable, Equatable, Comparable, Number, Convertible, Stringifiable, Parseable
Conversions: to_i8, to_i16, to_i32, to_i64, to_u8, to_u16, to_u32, to_u64, to_f32, to_str
Overflow Behavior: IEEE 754 (infinity/NaN)
Example:
3.14
1.0 2.0 +
i8¶
Description: 8-bit signed integer.
Size: 1 byte
Range: -128 to 127
Default: 0
Traits Implemented: Stackable, Addable, Multiplyable, Exponentiable, Logarithmic, Math, Orderable, Equatable, Comparable, Bitwise, Number, Size, Convertible, Stringifiable, Parseable
Conversions: to_i16, to_i32, to_i64, to_u8, to_u16, to_u32, to_u64, to_f32, to_f64, to_str
Overflow Behavior: Wrapping
Example:
42:i8
127:i8 1:i8 + // => -128 (wraps)
i16¶
Description: 16-bit signed integer.
Size: 2 bytes
Range: -32,768 to 32,767
Default: 0
Traits Implemented: Stackable, Addable, Multiplyable, Exponentiable, Logarithmic, Math, Orderable, Equatable, Comparable, Bitwise, Number, Size, Convertible, Stringifiable, Parseable
Conversions: to_i8, to_i32, to_i64, to_u8, to_u16, to_u32, to_u64, to_f32, to_f64, to_str
Overflow Behavior: Wrapping
Example:
1000:i16
i32¶
Description: 32-bit signed integer.
Size: 4 bytes
Range: -2,147,483,648 to 2,147,483,647
Default: 0
Traits Implemented: Stackable, Addable, Multiplyable, Exponentiable, Logarithmic, Math, Orderable, Equatable, Comparable, Bitwise, Number, Size, Convertible, Stringifiable, Parseable
Conversions: to_i8, to_i16, to_i64, to_u8, to_u16, to_u32, to_u64, to_f32, to_f64, to_str
Overflow Behavior: Wrapping
Example:
1000000:i32
i64¶
Description: 64-bit signed integer.
Size: 8 bytes
Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Default: 0 (default integer type)
Traits Implemented: Stackable, Addable, Multiplyable, Exponentiable, Logarithmic, Math, Orderable, Equatable, Comparable, Bitwise, Number, Size, Convertible, Stringifiable, Parseable
Conversions: to_i8, to_i16, to_i32, to_u8, to_u16, to_u32, to_u64, to_f32, to_f64, to_str
Overflow Behavior: Wrapping
Example:
42
1000000000
u8¶
Description: 8-bit unsigned integer.
Size: 1 byte
Range: 0 to 255
Default: 0
Traits Implemented: Stackable, Addable, Multiplyable, Exponentiable, Logarithmic, Math, Orderable, Equatable, Comparable, Bitwise, Number, Size, Convertible, Stringifiable, Parseable
Conversions: to_i8, to_i16, to_i32, to_i64, to_u16, to_u32, to_u64, to_f32, to_f64, to_str
Overflow Behavior: Wrapping
Example:
255:u8
u16¶
Description: 16-bit unsigned integer.
Size: 2 bytes
Range: 0 to 65,535
Default: 0
Traits Implemented: Stackable, Addable, Multiplyable, Exponentiable, Logarithmic, Math, Orderable, Equatable, Comparable, Bitwise, Number, Size, Convertible, Stringifiable, Parseable
Conversions: to_i8, to_i16, to_i32, to_i64, to_u8, to_u32, to_u64, to_f32, to_f64, to_str
Overflow Behavior: Wrapping
Example:
65535:u16
u32¶
Description: 32-bit unsigned integer.
Size: 4 bytes
Range: 0 to 4,294,967,295
Default: 0
Traits Implemented: Stackable, Addable, Multiplyable, Exponentiable, Logarithmic, Math, Orderable, Equatable, Comparable, Bitwise, Number, Size, Convertible, Stringifiable, Parseable
Conversions: to_i8, to_i16, to_i32, to_i64, to_u8, to_u16, to_u64, to_f32, to_f64, to_str
Overflow Behavior: Wrapping
Example:
4000000000:u32
u64¶
Description: 64-bit unsigned integer.
Size: 8 bytes
Range: 0 to 18,446,744,073,709,551,615
Default: 0
Traits Implemented: Stackable, Addable, Multiplyable, Exponentiable, Logarithmic, Math, Orderable, Equatable, Comparable, Bitwise, Number, Size, Convertible, Stringifiable, Parseable
Conversions: to_i8, to_i16, to_i32, to_i64, to_u8, to_u16, to_u32, to_f32, to_f64, to_str
Overflow Behavior: Wrapping
Example:
18000000000000000000:u64
Composite Types¶
Array¶
Description: Homogeneous collection of values of type T.
Size: Variable (depends on length and element type)
Syntax: [elements] or [elements :type]
Traits Implemented: Stackable, ArrayOf
Operations: at, slice, length, map, filter, reduce, each, foldl, foldr, concat, reverse, transpose, window, zip, enumerate, sum, mean
Example:
[1 2 3 4 5]
[1.0 2.0 3.0 :f32]
[[1 2] [3 4]]
String¶
Description: UTF-8 encoded string of characters.
Size: Variable
Syntax: "text"
Traits Implemented: Stackable, String, Sized, Sliceable, Concatenable, Iterable
Operations: length, concat, substr, split, join, replace, trim, find, starts_with, ends_with, format
Example:
"hello world"
"hello" " world" concat
Struct¶
Description: User-defined composite type with named fields.
Size: Sum of field sizes
Syntax: (field_types --) { field_names: } ::Name<T>? struct
Traits Implemented: Stackable, Equatable (if fields are), Stringifiable (if fields are)
Operations: get, set (field access)
Example:
(Number Number --) { x: y: } ::Point struct
3.0 4.0 Point
point ::x get
Union¶
Description: Tagged union with multiple possible variant types.
Size: Size of largest variant plus tag
Syntax: (variant_types --) { variants } ::Name<T>? union
Traits Implemented: Stackable, Equatable (if variants are), Stringifiable (if variants are)
Operations: Pattern matching with match
Example:
(T --) { Some(T) None } ::Option<T> union
42 Option::Some
Option::None
Enum¶
Description: Fixed set of named integer values.
Size: Size of underlying integer type (typically i64)
Syntax: { variants } ::Name enum
Traits Implemented: Stackable, Equatable, Orderable, Comparable, Convertible, Stringifiable
Operations: Pattern matching, comparison
Example:
{ Pending: Active: Complete: } ::Status enum
Status::Active
Standard Generic Types¶
Option¶
Description: Represents an optional value - either Some(T) or None.
Definition: (T --) { Some(T) None } ::Option<T> union
Use Cases: Nullable values, error handling, optional parameters
Traits Implemented: Stackable, Logical (None is falsy), Equatable, Stringifiable
Example:
42 Option::Some
Option::None
opt {
Some(x) => { x print }
None => { "Nothing" print }
} match
Result¶
Description: Represents success (Ok) or failure (Err) with values.
Definition: (T E --) { Ok(T) Err(E) } ::Result<T E> union
Use Cases: Error handling with details, operations that can fail
Traits Implemented: Stackable, Logical (Err is falsy), Equatable, Stringifiable
Example:
"success" Result::Ok
"error message" Result::Err
result {
Ok(val) => { val process }
Err(e) => { e "Error: " swap concat print }
} match
Special Types¶
Identifier¶
Description: Represents an identifier literal (name pushed as value).
Syntax: ::name
Traits Implemented: Identifier, Stackable, Equatable, Stringifiable
Use Cases: Struct/trait definitions, field access, meta-programming
Example:
::Point
::Addable
point ::x get
TokenString¶
Description: Unparsed code block enclosed in braces.
Syntax: { code }
Traits Implemented: Implementable
Use Cases: Function bodies, control flow blocks, lambda expressions
Example:
{ dup * }
{ 2 3 + } eval
Callable¶
Description: Executable code block created by lambda operator.
Created By: lambda operator
Traits Implemented: Stackable
Use Cases: First-class functions, higher-order operations
Example:
{ dup * } lambda ::square swap
5 square eval // => 25