Interactive Examples

Every widget below is a Therapy.jl island whose reactive body — the create_memo calls you see in the code — was compiled to WasmGC by WasmTarget and is running live in your browser. Move a slider and the Julia recomputes in wasm. No server, no Julia runtime — just the compiled function reacting to a signal.

Base

Transcendentals in wasm

The plainest case: Julia's own sin and exp, lowered straight to WasmGC. Drag x to evaluate a damped oscillation live — no stdlib, no overlays.

x, set_x = create_signal(1.5)

# Base sin/exp, compiled to wasm:
y = create_memo(() ->
    sin(x()) * exp(-x() / 3))
x = 1.5drag →

f(x) = sin(x) · exp(−x/3)

0.605

stdlib · Statistics

mean / std of a live vector

Three sliders become a Vector{Float64}; the real Statistics stdlib reduces it. Building the vector and the reductions all run in wasm.

a, set_a = create_signal(3.0)
b, set_b = create_signal(7.0)
c, set_c = create_signal(5.0)

m  = create_memo(() -> mean([a(), b(), c()]))
sd = create_memo(() -> std([a(), b(), c()]))
a = 3.0
b = 7.0
c = 5.0

mean(a, b, c)

5.0

std(a, b, c)

2.0

stdlib · LinearAlgebra

Norm of a 2×2 matrix

Four sliders are the entries of a matrix. LinearAlgebra.norm runs on the assembled 2×2 — matrix construction and the (Frobenius) norm both in wasm.

# four signals → a 2x2 matrix → its norm
nrm = create_memo(() ->
    norm([a() b()
          c() d()]))
a = 2.0
b = 1.0
c = 1.0
d = 3.0

‖A‖ = norm of the 2×2 matrix

3.873

SciML · ForwardDiff

Automatic differentiation, live

The headline. Drag x and the right-hand value is f′(x) computed by real forward-mode autodiff — ForwardDiff dual numbers, compiled to wasm. It is exact, not a finite difference: for f(x) = x³ − 2x you can check f′(x) = 3x² − 2.

x, set_x = create_signal(1.2)

# f'(x) by REAL forward-mode autodiff — ForwardDiff
# dual numbers, compiled to WasmGC, in your browser:
dfx = create_memo(() ->
    ForwardDiff.derivative(t -> t^3 - 2t, x()))
x = 1.2drag →

f(x) = x³ − 2x

-0.672

f′(x) — ForwardDiff

2.32