{#- This file was automatically generated - do not edit -#} {% extends "main.html" %} {% block tabs %} {{ super() }} {% endblock %} {% block content %}
You can specify concrete types to avoid typing errors that are common in dynamic languages. The type system is terse and allows you use funtional patterns such as Algebraic Data Types with ease.
class Nil {}
type Tree<T> = Nil | ('T, Tree<'T>, Tree<'T>);
let t: Tree<Int> = (
3,
(
1,
Nil(),
Nil()
),
(2, Nil(), Nil())
);
Ryna allows you to redefine parts of the syntax in order to create comprehensible libraries and custom meta modules that modify the behaviour of the language. NDL lets you use a BNF-like language to easily define syntax patterns.
{% raw %}syntax array_initialization from "<" Arg(, type) ">["
[{Arg(, elems) "," [s]} Arg(, elems)] "]" {
let res = arr<$type>();
@elems.i {
res.push($elems.i);
}
return move(res);
}
// Now we can use this syntax
let arr = [1, 2, 3, 4];{% endraw %}
Use built-in arbitrary length integers to construct mathematical algorithms. Other common types such as 64 bit floating point numbers and booleans are also supported natively by the language.
fn gcd(a: Int, b: Int) -> Int {
while b != 0 {
let r = a % b;
a := *b;
b := move(r);
}
return *a;
}
let res = gcd(5, 10);
Install the interpreter and learn about the language
See some examples of what you can do with Ryna
Want to share your thoughts or propose a feature?