An APL-inspired functional array language written in Rust.
PulseLang is a concise, composable notation where arrays are the fundamental data type and operations implicitly map over collections. Inspired by APL, K/Q, and BQN — designed for time-series analytics, signal processing, and vector computation.
cargo build --release
# REPL
./target/release/pulselang
# Run a script
./target/release/pulselang examples/demo.pulse
# Benchmarks
cargo run --release --bin benchmark ) 2 * 3 + 4
14
) 1 2 3 + 10 20 30
11 22 33
) sum 1 2 3 4 5
15
) avg 10 20 30
20
) 1 2 3 4 5 |> deltas |> sum
4
) double: {x * 2}
) double[21]
42
) {[a;b] a + b}[3; 4]
7
) mavg[3; 1.0 2.0 3.0 4.0 5.0]
1 1.5 2 3 4
) ema[0.5; 1.0 2.0 3.0 4.0]
1 1.5 2.25 3.125
) deltas 10 13 17 22
10 3 4 5
) `a`b`c ! 1 2 3
`a:1 `b:2 `c:3
) x: 10 20 30 40 50
) x[0]
10
) x[-1]
50
) x[10010b]
10 40
| Type | Literal | Description |
|---|---|---|
int |
42 |
64-bit signed integer |
float |
3.14 |
64-bit IEEE 754 float |
bool |
1b, true |
Boolean |
sym |
`host |
Interned symbol |
str |
"hello" |
UTF-8 string |
ts |
2024.01.15D14:30:00 |
Nanosecond timestamp |
dur |
5m, 1h, 30s |
Time duration |
+ - * % (divide) ^ (power) mod
= <> < > <= >= ~ (match) like
sum avg min max count first last med dev var
sums avgs mins maxs prds
til rev asc desc distinct group flip raze , (join) # (take) _ (drop) ? (find) in
deltas ratios prev next mavg msum ema wma xbar cor fills ffill bfill
f' x (each) f/ x (over/reduce) f\ x (scan) f': x (each-prior)
Run cargo run --release --bin benchmark to see performance across vector arithmetic, aggregations, scans, sorting, filtering, lambdas, and pipelines.
Extracted from PulseDB as a standalone language interpreter.
MIT