An object-oriented language that reads like the math on your whiteboard. Fewer tokens for humans and models alike.
Write code that looks like your writeboard.
First-class support for dollars, cents, and percentages. No more money bugs from floats.
Meters, feet, kilograms - with automatic conversion and dimensional analysis. Mismatched units caught at compile-time.
3.14 is an exact decimal, not an IEEE float. Approximation is opt-in with ~ — so the default never surprises your accountant.
In the repo, check out doc/examples.
Define a class with +, a method with ->, and output with <<.
Arity after the slash defines anonymous arguments.
Instance variables are assigned in the constructor with @. The ro suffix makes them read-only.
The prime notation (x') refers to the same-named property on the argument: x - x' means "my x minus their x."
Δx compacts it further.
A block is just -> followed by an expression, inside it free vars like item bind in lexical order to block params.
Block passthrough: pass a trailing block to a method that doesn't take one, and the block iterates the method's result. bag.items -> s += item loops over the return value of #items.
case and recase were in a boatDispatch with case/when. When an arm needs to re-enter the decision with a new value, recase expr re-dispatches the enclosing case.
Because symbols and small strings are interned at compile time, a case over them compiles to a real LLVM switch.
With Complex<f64> the compiler stamps out a specialized class with native f64 arithmetic.
Constraints are declared with with T in (…).
Used for Complex, Quaternion, and larger algebras up to 256 dimensions.
Annotate a function with @gpu fn and the compiler lowers it to Metal Shading Language while the rest of the file compiles to native code through LLVM.
Types are ascribed with ## f32[] hints. Inside the kernel, gpu.thread_position_in_grid and friends map straight onto Metal's execution model — and simdgroup 8×8 cooperative matrices are available for tiled matmuls.
This example is the project's smoke test: it compiles, dispatches on-device, and reads back [2, 3, 4].
A Tensor owns one shared allocation with three faces: a CPU array, a Metal buffer, and tensor views when the platform supports them — zero copies between them.
.linear runs bf16 matmuls on the Metal backend; .matmul, views, broadcasting, reductions, and .softmax compose into transformer math. This is the library's capstone test: single-head self-attention, on-device, attention rows summing to 1 within 5×10⁻⁸.
Three compile-time math modes: strict, precise (the default), and fast. Precise mode contracts a direct a*b + c into one FMA — but refuses to contract a*b − c*d, so determinants and cross products of equal terms stay exactly zero.
Override the ambient mode lexically with @strictmath / @fastmath blocks, even inside a method body. And fma(a, b, c) guarantees a single-rounding fused multiply-add in every mode.
Tungsten treats currency as a first-class type. No floating-point rounding errors. No string formatting gymnastics. Just write the dollar sign and go.
Percentages work intuitively — price - 15% calculates the discount. Chain operations freely: price - 15% + 8.25% applies a discount then adds tax.
Mix dollars and cents naturally. Tungsten handles the conversion and precision automatically.
Attach units directly to numbers. Tungsten understands dimensional analysis — multiplying length × length gives area, volume gives volume.
Mixing incompatible dimensions raises a dimension mismatch error. No more silently adding meters to kilograms.
Constants like the speed of light carry their units through every calculation. Einstein's equation isn't a comment — it's working code.
Side-by-side with the languages you know.
| Feature | Tungsten | Python | Ruby |
|---|---|---|---|
| Output | << x |
print(x) |
puts x |
| Class | + Point |
class Point: |
class Point...end |
| Method | -> distance/1 |
def distance(self, other): |
def distance(other)...end |
| Map | list/sq |
[x**2 for x in list] |
list.map { it ** 2 } |
| Generics | Complex<f64> (monomorphized) |
complex (boxed) |
Complex (boxed) |
| GPU kernel | @gpu fn — in the language |
CUDA / Triton DSL | FFI to C |
| Interpolation | "[name]" |
f"{name}" |
"#{name}" |
| Block ending | (dedent) |
(dedent) |
end |
Tungsten is made in America - my semiquincentennial gift to you.
W · 183.84 u · m.p. 3695 K · version 2026.07.04
Tools, packages, and documentation designed with the same care as the language itself.
Find, install, and share Tungsten packages. Dependency resolution, semantic versioning, and the package layout are part of the preview toolchain.
Explore packages →The language specification: lexical structure, semantics, floating-point math modes, units of measurement, and the WValue encoding.
Read the spec →An interactive REPL that plots. Type ? Σ(2x⁷ + 3x²) and get a rendered curve in your terminal — then scrub coefficients live with the arrow keys, ∫ shades the area under it.
Questions, ideas, and collaboration. File issues, start design discussions, and follow the preview work in the open.
Join the discussion →Install in seconds. Write your first program in minutes.
Fall in love before your mid-afternoon coffee.
Public preview · macOS (Apple silicon) & Linux · requires clang/LLVM · Metal GPU features require supported macOS and Apple hardware