Skip to main content

Module stdlib

Module stdlib 

Source
Expand description

The standard library — written in Cairn, authored through the one Core API, exactly like the Tier-2 web framework.

These are the generic higher-order list functions every real language has (map/filter/fold). They exist here, in Cairn, only because the language now has the two things that make them expressible: real generics and first-class functions/closures. Before the keystone, code that needed them hand-rolled a bespoke index recursion every time (see the framework’s old render_kids); now it passes a closure.

Each public function is a thin entry over an index-recursive _at helper — there is no drop-first list primitive, so iteration is by index. All are pure: the closure’s Fn type carries no effects (an effect-polymorphic stdlib would need effect rows — out of scope, a documented v0.4 boundary). Calls among them resolve when an app assembles its module; the content-addressed store dedups them.

Functions§

list_functions
map, filter, fold (each with its index-recursive _at helper).