Skip to content

std

The std module provides core language facilities.

Types

Name Description
args Iterator over an argument pack
array Mutable ordered sequence
bin Immutable binary data
BytecodeError Bytecode verification error
bool Boolean (true / false)
CanceledError Strand cancellation
CompileError Compilation error
ConcurrencyError Concurrent access violation
CyclicImportError Cyclic module dependency
dict Mutable ordered dictionary
set Mutable ordered set
Error Abstract base error type
FieldError Nonexistent field access
float 64-bit floating point
func Callable value
ImmutableError Mutation of an immutable value
ImportError Module import failure
IndexError Out-of-bounds index access
int 64-bit signed integer
InterruptError External interruption
Iter Abstract iterator type
Iterable Abstract iterable type
IterStop Error raised when an iterator is exhausted
MissingKeyError Required keyword argument not provided
MissingPosError Required positional argument not provided
Nil Type object for nil
OverflowError Integer overflow
range Numeric range for iteration
record Record with dot-syntax access
RuntimeError Ordinary runtime failure supertype
StateError Invalid operation for current state
Sinkable Abstract sinkable type
Sink Abstract sink type
SinkStop Error raised when a sink is closed
str Immutable UTF-8 string
sym Interned symbol
tuple Immutable ordered sequence
type Type of types
TypeError Wrong type for an operation
UnexpectedKeyError Unexpected keyword argument
UnexpectedPosError Unexpected positional argument
UnsupportedError Unsupported operation
ValueError Invalid value for an operation
value Abstract supertype of all values
ZeroDivError Integer division or modulo by zero

Values

nulliter

Acts as both an iterator and a sink that performs no operations.

  • As an iterator: nulliter never yields any items.
  • As a sink: nulliter silently discards all items.

Functions

dbg value

Converts a value to its debug representation. Shows internal structure (e.g. quotes strings, shows type tags).

Parameters:

Name Type Description
value the value to convert

Returns: str

record ...

Creates a record from keyword arguments.

Parameters:

Name Type Description
keyword args become fields

Returns: record

let r = record name: Alice age: 30
echo $r.name  # Alice

arg value

Converts a value to its external argument representation. Preserves the literal textual form of values where possible, which is useful for passing values as command-line arguments to external programs.

Parameters:

Name Type Description
value the value to convert

Returns: str

hash ...values

Returns a hash code computed over all supplied values in sequence. Passing multiple values is useful for combining fields in a (hash) implementation:

def (hash) self
  hash $self.x $self.y $self.z

Parameters:

Name Type Description
...values one or more values to hash

Returns: int