Shell examples
Shells are domain-specific libraries built on the Chelis core. Each shell has its own subdirectory in src/shells/ with standalone examples that compile and run independently.
coral is a typed dataframe library. The hello-chelis examples demonstrate:
- Typed columns: each column carries its element type and dimension name at compile time.
- group_by: aggregation with type-safe group keys.
- Joins: inner, left, and outer joins with compile-time column compatibility checks.
- Rolling windows: windowed aggregations over ordered frames.
- Reshape: pivot and melt operations that transform frame structure.
- CSV/JSON I/O: reading and writing with schema inference and validation.
- AD through frame ops: gradients propagate through dataframe transformations, enabling differentiable data pipelines.
import coral.{Frame, read_csv}
let df: Frame[Date: DateTime, Price: f64, Volume: i64] = read_csv("market.csv")
let daily = df |> group_by(dim=Date) |> agg(mean(Price), sum(Volume))nautilus
Section titled “nautilus”nautilus provides scientific computing primitives. The examples cover:
- Special functions (gamma, beta, bessel, erf)
- Probability distributions (normal, poisson, exponential, and others) with sampling and density
- Linear algebra (decompositions, solvers, eigenvalues)
- Statistics (moments, quantiles, correlation)
- Distance metrics (euclidean, cosine, mahalanobis)
- Root-finding (bisection, Newton, Brent)
- Numerical integration (quadrature, Monte Carlo)
- ODE and SDE solvers (Euler, RK4, Milstein)
- Interpolation (linear, cubic spline, Chebyshev)
- Optimization (gradient descent, L-BFGS, constrained)
- Hypothesis tests (t-test, chi-squared, KS)
- Curve fitting (least squares, nonlinear)
import nautilus.{distributions, linalg}
let prior = distributions.Normal(mu=0.0, sigma=1.0)let samples = prior.sample(n=1000) with seed(7)let cov = linalg.cov(samples)octant
Section titled “octant”octant translates LaTeX mathematical notation into executable Chelis code. The examples show:
- Reading
.texinput files containing mathematical definitions. - Translation to canonical Deep representation with full provenance metadata (source spans, rule names).
- Decompilation from Deep back to human-readable Surf.
This pipeline lets researchers take equations from papers and obtain runnable, type-checked implementations with a traceable link back to the original notation.
import octant.{translate_tex}
let deep_ast = translate_tex("definition.tex")let surf_code = deep_ast.decompile()c-earchin
Section titled “c-earchin”c-earchin takes structured requirements (written in a finance-flavored EARS notation) and produces Chelis property witnesses: compilable code that, if it type-checks, constitutes evidence that the requirement is satisfiable. The examples demonstrate:
- Parsing EARS requirement documents.
- Generating property witnesses with span diagnostics that trace each witness back to the originating requirement.
- Compile-time verification: if the witness type-checks, the property holds.
import c_earchin.{parse_ears, generate_witnesses}
let reqs = parse_ears("margin_rules.ears")let witnesses = generate_witnesses(reqs)// chelis check verifies all witnesses type-checkschool
Section titled “school”school provides ML layer primitives and training loop utilities. The examples cover:
- Layer definitions (Linear, Conv2d, LayerNorm, Attention)
- Parameter initialization strategies
- Training loops with gradient accumulation
- Learning rate schedules
- Checkpointing
import school.{Linear, train, Adam}
let model = Linear[In: 784, Out: 10]let optimizer = Adam(lr=0.001)
train(model, optimizer, data_loader, epochs=10)