Besides Types, you can also define functions in a
\declare is one of the symbols available in every namespace and will put all symbols into the namespace which has been used to call it.
You can give a type as flow argument which then declares symbols in the namespace of that type instead.
Lexical order of symbol declarations is significant, you cannot refer to a symbol before it is declared.
\declare calls are an exception to that rule, inside declarations you can refer to any symbol declared in the same
This allows for circular types and recursive functions.
Record types declare fields in the same way functions declare parameters.
Any parameter configuration on a record type's fields will be used for its constructor signature.
A typical configuration is to set the
primary parameter, so that it takes the primary block as argument in a call.
The primary block of
\declare is for public symbols, which can be imported to other modules.
There is a
private parameter available for symbols that should not be exported.
When declaring functions, you can explicitly give a
return argument to set their return type, but Nyarna has been designed to infer it.
Return types can be inferred even in presence of direct or indirect recursion.
When declaring function parameters, you can give them default block configurations.
The details will be discussed in Headers and Swallowing.
These default configurations are what cause
\func to use special syntax for symbol and parameter declarations respectively.
Since functions are first-class values, you can declare anonymous functions with
\func outside of
There is a keyword
\builtin that takes parameters and a return type.
This declares a builtin function whose implementation is to be provided by the Nyarna processor.
Knowing this, you can read the system.ny file of the standard library.
This file is automatically loaded and defines all predefined symbols.