Examples Tour

← Back to Language Guide

A guided reading order through every program in cookbook/. Each entry gives a one-line summary and a link to the file (and to the in-depth doc where one exists).


Reading order

If you are new to Eta, work through the Beginner and Symbolic & Logic sections first. The AAD & Finance and Causal & Portfolio sections build on each other and culminate in portfolio.eta.


Beginner

ExampleTopic
hello.etaFirst program: module, import, defun, recursion
basics.etaValues, bindings, cond, records, quoting
functions.etadefun, lambda, closures, variadics, letrec
higher-order.etamap*, filter, foldl, zip, range
composition.etacompose, flip, negate, manual currying
recursion.etaFibonacci, deep flatten, Ackermann, Hanoi
exceptions.etacatch / raise, dynamic-wind, structured payloads

Symbolic & Logic

ExampleTopic
boolean-simplifier.etaTree rewriting, De Morgan, fixed-point
symbolic-diff.etaComputer algebra: differentiation + simplification
unification.etaRaw logic-var, ==, findall
logic.etaRelations: parento, grandparento, membero
send-more-money.etaClassic CLP(FD) cryptarithm
nqueens.etaN-Queens via CLP

Reference: Logic, CLP(FD), CLP(B).


AAD & Finance

ExampleTopicWalkthrough
aad.etaReverse-mode AD primer, gradAAD
european.etaBlack–Scholes Greeks (1st & 2nd order)European options
sabr.etaSABR vol surface, Hagan approximationSABR
xva.etaCVA / FVA sensitivities via AADXVA
xva-wwr/Wrong-Way Risk via do-interventionsXVA with WWR

Statistics & ML

ExampleTopic
stats.etaDescriptive stats, OLS
torch.etalibtorch tensor / autograd basics
tests/torch/Layer / optimiser smoke tests

Reference: Stats, Torch.


Concurrency

ExamplePattern
message-passing.etaParent / child via PAIR
inproc.etaspawn-thread with closure capture
worker-pool.etaParallel fan-out
parallel-map.etaMap over a list, one worker per item
parallel-fib.etaRecursive parallel Fibonacci
monte-carlo.etaEmbarrassingly parallel π estimation
scatter-gather.etaSURVEYOR / RESPONDENT
pub-sub.etaTopic-filtered PUB / SUB
echo-server.eta, echo-client.etaREQ / REP
distributed-compute.etaCross-machine TCP messaging

Reference: Message Passing, Networking, Network Message Passing, Supervisor.


Causal & Portfolio

ExampleRoleWalkthrough
causal_demo.etaPrimer: symbolic + causal + CLP + libtorchCausal
do-calculus/Worked do-calculus identification problemsCausal
fact-table.etaColumnar fact tables for analyticsFact Table
portfolio-lp.etaLP construction via std.clpr
portfolio.etaEnd-to-end causal portfolio enginePortfolio

Packaging

ExampleTopicWalkthrough
packaging/end-to-end/End-to-end package flow: local library + app path dependencyFirst App

Notebooks

NotebookTopic
notebooks/Jupyter examples (xeus-eta kernel)

See Jupyter for kernel installation.