11. Standard Libraries
Aergia includes a modular suite of several core standard libraries built directly into the toolkit.
Library Overview
| Library File | Category | Core Purpose | | :— | :— | :— | | std_arr.aer | Array Utilities | Higher-order mapping, reducing, filtering, and sequence sorting. | | std_bool.aer| Boolean Logic | Definitions and validation constraints for truth values. | | std_error.aer| Exception Architecture | Standard identifiers mapped to the interpreter’s native runtime exceptions. | | std_str.aer | String Manipulation | Substring evaluation, whitespace trimming, splitting, and merging. |
std_arr.aer (Array Utilities)
Core Predicates & Lookups
has :arr itm:Checks ifitmexists insidearr. Returns1if found,0otherwise.index :arr tar:Searches fortarsequentially withinarr. Returns its zero-indexed location, or_1if absent.len :arr:Iterates and counts total element length. Valid for both arrays and string bounds.
Functional Mechanics
map :arr f:Passes each item inarrto expression/functionfand generates a transformation array.filter :arr f:Filters items inarrbased on boolean evaluations from predicate functionf.reduce :arr ini f:Foldsarrinto a singular accumulator value, initialized atini, by chaining calls via functional folderf.
Transformation & Ordering
reverse :arr:Inverts the sequence layout ofarr.iota :n:Generates a list ranging sequentially from0ton - 1.zip :a b:Pairs items between collectionsaandblinearly. The size matches the shorter input bound.enumerate :arr:Zips array items with their corresponding index identifiers (<index item>).sort :arr:Performs an in-place bubble sort ordering items ascendingly.sortby :arr f:Sorts collection sequence by matching values after extracting key results via closure projectionf.
Logical Checks & Flattening
any :arr f:Short-circuits or yields1if any element matches criteria context defined inf. Returns0if all fail.all :arr f:Verifies every component element honors constraints insidef. Returns0if any single item fails.flat :arr:Merges two-dimensional array layouts downward into a unified one-dimensional list structure.flatmap :arr f:Combines higher-order element transformations and automated flattening steps into a single call.
std_bool.aer (Boolean Logic)
Definitional Constants
true: Maps value implicitly to integer scalar1.false: Maps value implicitly to integer scalar0.
Utility Signatures
is_bool :val:Strictly examines whether targetvalis structurally formatted as valid boolean data (0or1).
std_error.aer (Exception Architecture)
Provides named global string constants matching native errors emitted by the nodes.py interpreter framework (ETYPEMAP).
DivisionByZeroIndexOutOfRangeKeyNotFoundTypeErrorNameErrorValueErrorFileNotFound:PermissionDeniedImportErrorConstraintErrorInterpolationErrorRuntimeError
std_str.aer (String Manipulation)
Merging & Splitting
join :arr del:Flattens target array entries into a single string stream, inserting string literaldelbetween each element boundary.split :str del:Slices string inputs into pieces delimited across boundaries marking character matches todel. If empty, returns individual character items.
Traversal & Mutation
has :str seq:Runs a sliding character window look-ahead sequence matching scan to check if substringseqis insidestr. Returns1if true,0otherwise.reverse :str:Inverts individual character arrays before stitching components back together.ltrim :str:Clears leading string spacer layout blocks from the left margin until text contents hit a non-space boundary.rtrim :str:Clears trailing string space margins working backward from the right-hand side.trim :str:Symmetrically runs bothltrimandrtrimpipelines across text targets.
std_type.aer (Type Checkers)
Data Types
is_int :val:Returns if value is equivalent to an integer or not.is_float :val:Returns if value is equivalent to an float or not.is_str :val:Returns if value is equivalent to an string or not.is_arr :val:Returns if value is equivalent to an array or not.
Iteration Types
is_iterable :val:Returns if value is iterable or not.is_empty :val:Returns if value is an empty iterable or not.