Standard library reference
The arr.ai standard library is available via the // syntax.
Packages#
The following standard packages are available:
//archive: Archive format utilities//bits: Bit utilities//encoding: Support for encoded data processing//eval: Evaluate strings holding arr.ai code//fmt: String formatting utilities//fn: Function manipulation utilities//grammar: Grammar features & processing//log: Print utilities//math: Math operations and functions//net: Network utilities//os: OS support//re: Regular expressions//rel: Relational operations//seq: Sequence utilities//str: String utilities//test: String utilities
Core functions#
The following functions are available at the root of the standard library.
//dict(t <: tuple) <: dict#
dict converts the tuple t to a dictionary.
Usage:
| example | equals |
|---|---|
//dict(()) | {} |
//dict((a: 1, b: 2)) | {"a": 1, "b": 2} |
//tuple(d <: dict) <: tuple#
tuple converts the dictionary d to a tuple. All keys must be strings. The
operation is shallow, so dictionary-structured values won't be converted.
Usage:
| example | equals |
|---|---|
//tuple({}) | () |
//tuple({"a": 1, "b": 2}) | (a: 1, b: 2) |