Base Types

Stella Core has two base types — Bool and Nat. The following extensions allow adding more base types with corresponding built-in operations on them.

Char

A type of single Unicode characters. Char values are possibly escaped characters in single quotes (e.g. 'a', 'я', '\n'). The following operations are available for the Char type:

  • fn Char::ord(c : Char) -> Nat — the numeric value of a character, corresponding to its Unicode code;
  • fn Char::chr(n : Nat) -> Char — a character corresponding to a given numeric value.

Any two Char values can be compared using the standard comparator operators: ==, <>, <, <=, >, >=.

String

A type of Unicode strings. String values are a sequence of possibly escaped characters in double quotes (e.g. "Hello, world!", "Привет, мир!\n"). The following operations are available for the String type:

  • fn String::length(s : String) -> Nat — length of a string;
  • fn String::concat(s1 : String) -> (fn(String) -> String) — a curried concatenation function that takes two Strings and produces a new String by concatenating the inputs;
  • fn String::fromNat(n : Nat) -> String — convert a given Nat value into a String.

Any two String values can be compared using the standard comparator operators: ==, <>, <, <=, >, >=.

Additionally, s1 + s2 is overloaded to mean String::concat(s1)(s2) whenever s1 and s2 are of type String.

Numeric Base Types

Integers

Rationals

Floating Point Numbers

Complex Numbers

Modular Arithmetic

Matrices

Aminoacids and Nucleotides