Ursa
A friendly, stable, general-purpose programming-language
Ursa helps you write code that will last a long time: a simple, general-purpose programming language that is easy to pick up and will work the same way long into the future.Latest release: vx.y.z (Date)
Latest release notes.
Latest news (18 March 2024)
Version 0.2.15 marks a milestone: it has a complete JavaScript back-end. So far this is not very useful; in particular, you can’t use it to compile an Ursa program to standalone JavaScript. But it does represent a considerable amount of work compiling Ursa to a different target, it comes with full sourcemap support, and will make it easier to use Ursa on the web and in IDEs.
Examples and Demo
Code
print("hello woods!")
Result
Output
Code
let fac = fn(x: Int): Int {
if x == 0 {1} else {x * fac(x - 1)}
}
fac(6)
Result
Output
Code
let sum = fn(l: List<Int>): Int {
let tot = 0
let i = 0
loop {
if i == l.len() { return tot }
tot := tot + l.get(i)
i := i + 1
}
}
sum([10, 30, 50, 5, 5])
Result
Output
Code
let newAccums = fn(): List<fn(x: Int): Void> {
let tot = 0
let l = [
fn(x: Int): Void {
tot := tot + x
},
fn(x: Int): Void {
tot := tot + x
},
]
tot := 2
l
}
let accums = newAccums() and
let accums2 = newAccums()
[
[accums.get(0)(1), accums.get(0)(1), accums2.get(0)(1)],
[accums.get(1)(1), accums.get(1)(1), accums2.get(1)(1)],
]
Result
Output
Result
Output
Rosetta Code
Find Ursa examples on Rosetta Code and add more!
Discuss and learn Ursa
Join us in our Matrix space! we have rooms for general discussion, newbies, and the web site.