A small, expressive language with pipes, pattern matching, shell integration, and a focus on clarity.
import std:io
import std:println
producer = || {
println("foo")
println("bar")
println("baz")
}
count_lines = || {
lines = io:stdin::read_lines()
return lines::length()
}
format = |n| "matches: ${n}"
producer() | `grep ba` | count_lines()
|> format
|> println
Suji combines the best ideas from functional and scripting languages into something that feels natural.
Stream data with shell-style | pipes or compose values with F#-style |> and <| operators.
data
|> parse
|> transform
|> println
Powerful match expressions with literals, regex patterns, conditions, and destructuring.
match email {
/^admin@/ => "admin",
/@corp\.com$/ => "employee",
_ => "guest",
}
Execute commands with backticks, pipe to shell tools, and mix closures with Unix utilities seamlessly.
files = `ls -la | grep ".txt"`
Higher-order functions, closures, and function composition with >> and << operators.
transform =
inc >> double >> format
Built-in support for JSON, YAML, TOML, CSV parsing, cryptographic hashing, encoding, and more.
config =
io:open("config.yaml")
::read_all()
|> yaml:parse
Embed expressions directly in strings and shell commands with ${...} syntax.
"Hello, ${name}! Sum: ${1 + 2}"
Quicksort in 14 lines of expressive, readable code.
import std:println
quicksort = |list| {
match list::length() {
0 => [],
1 => list,
_ => {
pivot = list[0]
rest = list[1;]
left = rest::filter(|x| x < pivot)
right = rest::filter(|x| x >= pivot)
quicksort(left) + [pivot] + quicksort(right)
},
}
}
unsorted = [64, 34, 25, 12, 22, 11, 90]
quicksort(unsorted) |> println # [11, 12, 22, 25, 34, 64, 90]