A friendly language that catches mistakes before your program runs.
Try it
Mistakes caught before it runs
Section titled “Mistakes caught before it runs”Map.get can’t promise an age, since the name might not be in the map, so
it gives back a Maybe: Some(age) or None.
Delete the None line. Nomi won’t run the program, and says the case is
missing None. Every program gets that check, before any of it runs.
The examples on this site run in your browser, and run again as you edit them.
fn age_of(name: String) -> String
ages = {"Ada" => 36, "Bo" => 7}
case Map.get(ages, name)
Some(age) -> "${name} is ${age}"
None -> "no age for ${name}"
end
end
fn main()
dbg age_of("Ada")
dbg age_of("Cy")
enddbg line 11: age_of("Ada") = "Ada is 36"
dbg line 12: age_of("Cy") = "no age for Cy"
The language
At a glance
Section titled “At a glance”No surprises at run time
No null. A lookup that can miss gives back a Maybe, a case has to cover every possibility, and / won't divide by an Int that might be zero. What can still stop a program.
Values never change
A value you hold can't change behind your back. To “change” one, you make a new one.
Pipes
prices |> Iter.filter(on_sale) |> Iter.sum() reads in the order the steps happen.
Tests beside the code
test blocks are ordinary Nomi, next to what they test, and nomi test runs them.
One file to ship
nomi build writes one executable that needs nothing installed, for your platform or another.
Go when you need it
A program can call Go libraries for what the standard library doesn't have.
Where to start
Pick your way in
Section titled “Pick your way in”Maybe are new to you.
You program already
Language Tour
The whole language, a chapter at a time, every example runnable.
You know a language well
Coming from…
Rust, Go, Elixir, TypeScript, Python, Kotlin, Swift or Ruby, mapped onto Nomi.
Install Nomi to run it on your own machine. The source is on GitHub.