Lime is a strongly, strictly typed language.
The default atomic types in Lime are:
bool(binary truth value,
float(floating-point number, e.g.,
Lists can be made out of any type, even lists themselves, by appending a
$ token. For example, a list of
int`s have the signature :code:`int$, and a list of
int$`s will have the signature :code:`int$$.
To define a struct, use the
struct directive at the top level of a program.
This will also define a new type,
To initialize a struct, use the
new keyword, which will initialize and return a new instance of the struct specified.
You can specify only a subset of the attributes when initializing, by not including the keys for those items:
Getting values of a
To get the values of a struct, use the
get command. For example,
would return the
first_name attribute of
In Lime, all functions must have a type specified for their return value and for their inputs. The type signature BNF is as following:
Lime has polymorphism, aka "overriding". This allows you to define a single function with different behavior when it is passed different types. For example,
would define the
increment function for
floats. This can also be used for optional arguments, like so:
if a prompt is not explicitly defined, it will default to