Functions
Syntax:
<fn> ::=
fn
<ident> <generics>? (<params>?) <return-type> ? <block-expr><params> ::= <param> (
,
<param> )*,
?<return-type> ::=
->
<type>
Examples
fn identity<T>(t: T) -> T {
t
}
fn naive_fib(n: number) -> number {
if n < 2 { n } else { naive_fib(n-1) + naive_fib(n-2) }
}