Skip to content

Repository files navigation

Fluent

Learnable math. A small language where math reads the way you read — left to right, no tables to memorize. Learn the whole thing in five minutes, right in a browser tab.

Take the tour — fifteen interactive rooms, from 1 + 2 to a value that finds √42 on its own. Or just open the playground and type.

Fluent is the working end of New Kind of Paper, an essay series about what math could feel like if pen, paper, and calculator were one instrument (part two, three, four, five).

Example gallery

demo
🌀Mandelbrot — the Mandelbrot set over the whole plane, sharper as you drag the depth▶ run
🦠Game of Life — Conway's Game of Life on a large grid▶ run
🔮The Name Dreamer — a small transformer that invents new names from a word list▶ run
🐦Combinators — combine functions without naming their arguments▶ run
📷Live edge detection — your webcam, edge-detected in real time▶ run
🎵Live spectrum — your microphone's frequency spectrum, live▶ run
🎸Pitch detector — the pitch of a note you hum▶ run
📈Linear regression — a line fit to points by gradient descent▶ run
🏔Touch the loss landscape — a ball you roll downhill on a loss surface▶ run
⚔️adam vs sgd — two optimizers descending the same surface from the same start▶ run
🌸Reaction–diffusion — two reacting chemicals that settle into spots and stripes▶ run
🔬Lenia — smooth, continuous cellular automata▶ run
🧲Spinning magnets — an animated vector field▶ run

More in the playground: press Ctrl+O for the full gallery.

the names, at a glance
glyphwordfull name
gradTensorGradient
ΣsumTensorSum
ΠprodTensorProduct
μmeanTensorMean
ceilTensorCeil
floorTensorFloor
maxTensorMax
minTensorMin
#lengthTensorLength
_gatherTensorGather
reshapeTensorReshape
..<rangeTensorRange
...TensorRangeInclusive
outerTensorOuter
^powTensorPower
rootTensorRoot
%modTensorRemainder
÷divTensorDivide
×mulTensorMultiply
~varTensorVariable
:=TensorAssign
iterFunctionIterate
FunctionPower
.applyFunctionApply
@evalFunctionEvaluate
$Reactive
watchTensorWatch
convTensorConvolution
onceSignalOnce

Some cells are still empty — the language is young, and names are earned.

IDE

Live evaluation on every keystroke, hover docs, unicode completion (type alpha, get α), syntax trees for quoted code, camera and microphone as tensor sources, and LLM code generation — write ;;a bouncing ball;; and it appears (bring your own Anthropic API key, set via the command palette). Hover any built-in for its doc card, or open the built-in Documentation for the reference.

Ctrl+O examples · Ctrl+S share as URL · Ctrl+P commands · Ctrl+Space complete — Safari reserves ⌘O, use O there

Run locally

git clone https://github.com/mlajtos/fluent.git
cd fluent && bun install
bun dev # → http://localhost:3000

The whole thing fits in a handful of files — read it, change it:

filewhat
language.tsthe language — grammar (Ohm), evaluator, prelude; tensors via jax-js, reactivity via preact signals
client.tsxthe IDE — components, visualizers, Monaco editor, playground
tour.tsthe tour — fifteen rooms, written in Fluent itself
tests.tslanguage tests (bun test ./tests.ts)
tests.browser.tsIDE tests in real Chromium (bun run test:browser)

About

tiny lang for differentiable tensors and reactive programming

Topics

Resources

Stars

19 stars

Watchers

0 watching

Forks

Contributors

Languages