# Standard Library: General functions

## alt


[%alt: a; b+]



any or empty

Prints the first argument that isn't the empty value ~. If all arguments are ~, prints ~.

### Parameters

aany
The first value to check.

bany+
The rest of the values to check.

## call


[%call: func; args]



any or empty

Calls the function func with the argument list args.

### Parameters

funcfunction
The function to call.

argslist
The arguments to pass to the function.

## cat


[%cat: values*]



any*

Prints the provided arguments in order.

### Parameters

valuesany*
The values to print.

## copy


[%copy: value]



any

Returns a shallow clone of value.

### Parameters

valueany
The value to clone.

## either


[%either: condition; true-val; false-val]



any

Returns true-val if condition is @true, or false-val if condition is @false.

### Parameters

conditionbool
The boolean value to use to select the output.

true-valany
The value to print if condition is true.

false-valany
The value to print if condition is false.

## irange


[%irange: a; b?; step?]



range

Creates a new inclusive range with the specified bounds and step value.

• If a and b are present, range will start at a (inclusive) and end at b (inclusive).
• If a is present but b is omitted, range will start at 0 (inclusive) and end at a (inclusive).

The step value determines the spacing of the range values and must be a positive integer. A step value of 0 defaults to 1.

The step value does not affect the first value in the range and is only applied on subsequent values.

### Parameters

aint
The starting (inclusive) bound. Used as the ending (inclusive) bound if b is omitted.

bint (optional)
The ending (inclusive) bound.

stepint (optional)
The absolute difference between adjacent values in the range.

## fork


[%fork: seed?]



Forks (overrides) the current RNG with a new RNG seeded by both the old RNG's seed and the specified seed. If no seed is provided, a random one is generated.

### Parameters

seedint | string (optional)
The seed value to branch with.

### Example

# Entangles {yee|woo} with {haw|hoo}, i.e. forces them both to pick the same index

[fork:a]{yee|woo}[unfork]-
[fork:a]{haw|hoo}[unfork]!

# Output is either "yee-haw!" or "woo-hoo!"


## nop


[%nop: args*]



Does absolutely nothing. Intended as a convenience function for use as a default/placeholder callback.

### Parameters

argsany*
The arguments to unceremoniously toss into a bottomless void, never to be seen again.

## range


[%range: a; b?; step?]



range

Creates a new exclusive range with the specified bounds and step value.

• If a and b are present, range will start at a (inclusive) and end at b (exclusive).
• If a is present but b is omitted, range will start at 0 (inclusive) and end at a (exclusive).

The step value determines the spacing of the range values and must be a positive integer. A step value of 0 defaults to 1.

The step value does not affect the first value in the range and is only applied on subsequent values.

### Parameters

aint
The starting (inclusive) bound. Used as the ending (exclusive) bound if b is omitted.

bint (optional)
The ending (exclusive) bound.

stepint (optional)
The absolute difference between adjacent values in the range.

## require


[%require: module-path]



Imports the module at the specified relative path and assigns it to a local variable with a name matching the file name.

Rant requires module files to have the .rant extension in order to load them; as such, it is not necessary to supply the file extension in the path.

### Parameters

module-pathstring
The path to the module to load.

### Example

# Import module my-module
[require: my-module]

# Call hello-world function in my-module
[my-module/hello-world]


## resolve


[%resolve: block]



any or empty

Resolves the specified block.

### Parameters

blockblock
The block to resolve.

## seed


[%seed]



int

Prints the seed value of the currently active runtime RNG.

## type


[%type: value]



string

Returns the name of value's type. The type name can be any of the following:

• string
• float
• int
• bool
• function
• list
• map
• special
• empty

### Parameters

valueany
The value whose type name to retrieve.

## unfork


[%unfork]



Removes the last RNG created by [fork] and resumes use of the previous RNG.