summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2021-01-24 22:08:56 +0100
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2021-01-24 22:08:56 +0100
commit73cc70358020538b13f2d5cf4e81426b13bbb85a (patch)
tree2fbc4a2c2be48f8ded80933dffe1445758b63c66
parent23d8224704b76737e746c5add47aa4cd96a7fd01 (diff)
...
-rw-r--r--content/fate_v1/aliases/default.md42
-rw-r--r--content/fate_v1/computations/_index.md2
-rw-r--r--content/fate_v1/computations/basics/_index.md145
-rw-r--r--content/fate_v1/computations/bools/_index.md56
-rw-r--r--content/fate_v1/computations/maths/_index.md58
-rw-r--r--content/fate_v1/declarations/_index.md6
-rw-r--r--content/fate_v1/declarations/events/_index.md18
-rw-r--r--content/fate_v1/declarations/types/_index.md66
-rw-r--r--content/fate_v1/extensions/_index.md5
-rw-r--r--content/fate_v1/files/_index.md (renamed from content/fate_v1/declarations/files/_index.md)2
-rw-r--r--content/fate_v1/instructions/_index.md2
-rw-r--r--content/fate_v1/notations/_index.md3
-rw-r--r--content/fate_v1/sequences/_index.md (renamed from content/fate_v1/declarations/sequences/_index.md)2
-rw-r--r--content/fate_v1/text_effects/_index.md (renamed from content/fate_v1/declarations/text_effects/_index.md)1
-rw-r--r--content/fate_v1/types/_index.md193
-rw-r--r--content/fate_v1/variables/_index.md (renamed from content/fate_v1/declarations/variables/_index.md)1
16 files changed, 461 insertions, 141 deletions
diff --git a/content/fate_v1/aliases/default.md b/content/fate_v1/aliases/default.md
deleted file mode 100644
index 1247545..0000000
--- a/content/fate_v1/aliases/default.md
+++ /dev/null
@@ -1,42 +0,0 @@
----
-title: Aliases
-weight: 4
----
-Nearly all computations and instructions have aliases, making it easier to
-write in the language when not used to it. This page provides most of them. As
-a general rule, all underscores (`_`) are optional, all `declare` can be
-replaced by `define` and `def`.
-
-* `abs`: `absolute`.
-* `and`: `/\`.
-* `>=`: `greater_equal_than`, `ge`.
-* `/`: `divide`, `div`.
-* `=`: `==`, `equals`, `eq`.
-* `declare_alias_type`: `declare_sub_type`, `typedef`.
-* `declare_structure_type`: `declare_structure`, `declare_dict_type`,
- `declare_dict`.
-* `declare_event_type`: `declare_event`.
-* `declare_sequence`: `declare_seq`, `declare_procedure`, `declare_proc`.
-* `ignore_error`: `ignore_warning`.
-* `free`: `release`, `destroy`.
-* `implies`: `=>`, `->`.
-* `is_member`: `contains`, `has`.
-* `=<`: `<=`, `lower_equal_than`, `le`.
-* `<`: `lower_than`, `lt`.
-* `-`: `minus`
-* `min`: `minimum`.
-* `max`: `maximum`.
-* `eval`: `evaluate`.
-* `%`: `mod`, `modulo`.
-* `new`: `reserve`, `create`.
-* `not`: `~`, `!`.
-* `add_element`: `add`.
-* `one_in`: `exactly_one_in`, `exactly_one`, `one`.
-* `remove_at`: `remove_element_at`, `remove_elem_at`.
-* `set`: `set_value`, `set_val`, `set_variable`, `set_var`.
-* `var`: `variable`.
-* `visit`: `call`, `call_sequence`, `call_procedure`, `call_seq`, `call_proc`,
- `visit_sequence`, `visit_procedure`, `visit_seq`, `visit_proc`.
-* `jump_to`: `continue_as`, `continue_to`, `continue_with`, `jump`, `go_to`,
- `exec`. And you can suffix `_proc`, `_procedure`, `_seq`, or `_sequence` to
- any of these.
diff --git a/content/fate_v1/computations/_index.md b/content/fate_v1/computations/_index.md
index 9b835de..175d039 100644
--- a/content/fate_v1/computations/_index.md
+++ b/content/fate_v1/computations/_index.md
@@ -1,6 +1,6 @@
---
title: Computations
-weight: 3
+weight: 4
---
Computations are operations returning values. They do not modify the memory.
diff --git a/content/fate_v1/computations/basics/_index.md b/content/fate_v1/computations/basics/_index.md
new file mode 100644
index 0000000..e8a8816
--- /dev/null
+++ b/content/fate_v1/computations/basics/_index.md
@@ -0,0 +1,145 @@
+---
+title: Computations
+weight: 2
+---
+Computations are values. They may read from the memory, but do not modify it
+(with a single exception).
+
+### TEXT
+{{< fatecode >}}(text [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}}
+
+Returns a `text` node containing the text representation of `C0` ... `CN`.
+
+### VARIABLE | REFERENCE
+{{< fatecode >}}(var {String}){{< /fatecode >}}
+
+Returns the value of the variable `{String}`, or a reference to it if
+applicable. Structure members can be accessed by using `.` in `{String}`.
+
+### SEQUENCE | PROCEDURE
+{{< fatecode >}}(sequence {String}){{< /fatecode >}}
+
+Returns a `[SEQUENCE]` value corresponding to the sequence named `{String}`.
+Said sequence can be defined at a later point.
+
+### STRUCTURE FIELD ACCESS
+{{< fatecode >}}{Structure Var Name}.{Field Name}{{< /fatecode >}}
+{{< fatecode >}}(field {String} [STRUCTURE VAR]){{< /fatecode >}}
+
+Accesses the `{String}` field of the structure `[STRUCTURE VAR]`. Using `.` to
+access fields is recommended over the use of this operator.
+
+### STRUCTURE FIELD VALUE
+{{< fatecode >}}(get_field {String} [STRUCTURE]){{< /fatecode >}}
+Returns the value of the `{String}` field of the structure `[STRUCTURE]`.
+
+### TEMPORARY VARIABLES
+{{< fatecode >}}(let (({V0 = String} [C0 = COMPUTATION]) ... ({VN = String} [CN = COMPUTATION])) [R = COMPUTATION]){{< /fatecode >}}
+
+Defines a hierarchical level and local variables `V0` ... `VN` with values `C0` ... `CN`, and returns the value of `[R]`.
+
+### CAST
+{{< fatecode >}}(cast [TYPE] [COMPUTATION*]){{< /fatecode >}}
+
+Transforms `[COMPUTATION*]` into a value of type `[TYPE]`. Note that the variable
+shorthand cannot be used for `[COMPUTATION*]`. The following type changes are
+allowed:
+* `[FLOAT]` to `[FLOAT]`, `[INT]`, and `[STRING]`.
+* `[INT]` to `[FLOAT]`, `[INT]`, and `[STRING]`.
+* `[BOOL]` to `[BOOL]` and `[STRING]`.
+* `[STRING]` to `[BOOL]` (`true` and `false`), `[FLOAT]`, `[INT]`, and`[STRING]`.
+
+### RANDOM NUMBER
+{{< fatecode >}}(rand [I0 = INT] [IN = INT]){{< /fatecode >}}
+
+Returns a random number between `I0` and `IN` (inclusive).
+
+## Basic Operators
+### BOOL OPERATORS
+{{< fatecode >}}(and [B0 = BOOL] ... [BN = BOOL]){{< /fatecode >}}
+
+Standard conjunction (minimum of 2 arguments).
+
+{{< fatecode >}}(or [B0 = BOOL] ... [BN = BOOL]){{< /fatecode >}}
+
+Standard disjunction (minimum of 2 arguments).
+
+{{< fatecode >}}(not [BOOL]){{< /fatecode >}}
+
+Standard negation.
+
+{{< fatecode >}}(implies [B0 = BOOL] [B1 = BOOL]){{< /fatecode >}}
+
+Standard implication.
+
+
+{{< fatecode >}}(one_in [B0 = BOOL] ... [BN = BOOL]){{< /fatecode >}}
+
+true if, and only if, exactly one of the operands is true.
+
+### MATH OPERATORS
+All operands must be of the same type, which is also the type returned by the
+operation.
+
+{{< fatecode >}}(+ [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+
+Standard addition (minimum of 2 arguments).
+
+{{< fatecode >}}(- [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+
+Standard substraction (minimum of 2 arguments).
+
+{{< fatecode >}}(* [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+
+Standard multiplication (minimum of 2 arguments).
+
+{{< fatecode >}}(/ [N0 = NUMBER] [N1 = NUMBER]){{< /fatecode >}}
+
+Standard division. Note that a division on integers is indeed a integer
+division.
+
+{{< fatecode >}}(^ [N0 = NUMBER] [N1 = NUMBER]){{< /fatecode >}}
+
+Standard exponentiation.
+
+{{< fatecode >}}(% [I0 = INT] [I1 = INT]){{< /fatecode >}}
+
+Standard modulo operation.
+
+{{< fatecode >}}(min [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+
+Lowest value among the operands.
+
+{{< fatecode >}}(max [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+
+Highest value among the operands.
+
+{{< fatecode >}}(clamp [N0 = NUMBER] [N1 = NUMBER] [N2 = NUMBER]){{< /fatecode >}}
+
+Equivalent to `(max N0 (min N1 N2))`.
+
+
+{{< fatecode >}}(abs [NUMBER]){{< /fatecode >}}
+
+Positive value of `[NUMBER]`.
+
+### COMPARISON OPERATORS
+{{< fatecode >}}(= [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}}
+
+True if, and only if, all operands are equal.
+
+{{< fatecode >}}(< [C0 = COMPARABLE] [C1 = COMPARABLE]){{< /fatecode >}}
+
+True if, and only if, `C0` is strictly lower than `C1`.
+
+{{< fatecode >}}(=< [C0 = COMPARABLE] [C1 = COMPARABLE]){{< /fatecode >}}
+
+True if, and only if, `C0` is lower or equal to/than `C1`.
+
+{{< fatecode >}}(> [C0 = COMPARABLE] [C1 = COMPARABLE]){{< /fatecode >}}
+
+True if, and only if, `C0` is strictly higher than `C1`.
+
+{{< fatecode >}}(>= [C0 = COMPARABLE] [C1 = COMPARABLE]){{< /fatecode >}}
+
+True if, and only if, `C0` is higher or equal to/than `C1`.
diff --git a/content/fate_v1/computations/bools/_index.md b/content/fate_v1/computations/bools/_index.md
new file mode 100644
index 0000000..6a31042
--- /dev/null
+++ b/content/fate_v1/computations/bools/_index.md
@@ -0,0 +1,56 @@
+---
+title: Booleans
+weight: 2
+---
+
+All arguments are assumed to be of the same type.
+
+### Conjunction
+{{< fatecode >}}(and [B0 = BOOL] ... [BN = BOOL]){{< /fatecode >}}
+
+Standard conjunction (minimum of 2 arguments).
+
+### Disjunction
+{{< fatecode >}}(or [B0 = BOOL] ... [BN = BOOL]){{< /fatecode >}}
+
+Standard disjunction (minimum of 2 arguments).
+
+### Negation
+{{< fatecode >}}(not [BOOL]){{< /fatecode >}}
+
+Standard negation.
+
+### Implication
+{{< fatecode >}}(implies [B0 = BOOL] [B1 = BOOL]){{< /fatecode >}}
+
+Standard implication.
+
+### Exclusivity
+{{< fatecode >}}(one_in [B0 = BOOL] ... [BN = BOOL]){{< /fatecode >}}
+
+true if, and only if, exactly one of the operands is true. There needs to be at
+least one argument.
+
+### Equality
+{{< fatecode >}}(= [C0 = COMPUTATION*] ... [CN = COMPUTATION*]){{< /fatecode >}}
+True if, and only if, all operands are equal. Takes at least 2 arguments.
+
+### Strictly less than
+{{< fatecode >}}(< [C0 = COMPARABLE] [C1 = COMPARABLE]){{< /fatecode >}}
+
+True if, and only if, `C0` is strictly lower than `C1`.
+
+### Less than
+{{< fatecode >}}(=< [C0 = COMPARABLE] [C1 = COMPARABLE]){{< /fatecode >}}
+
+True if, and only if, `C0` is lower or equal to/than `C1`.
+
+### Strictly more than
+{{< fatecode >}}(> [C0 = COMPARABLE] [C1 = COMPARABLE]){{< /fatecode >}}
+
+True if, and only if, `C0` is strictly higher than `C1`.
+
+### More than
+{{< fatecode >}}(>= [C0 = COMPARABLE] [C1 = COMPARABLE]){{< /fatecode >}}
+
+True if, and only if, `C0` is higher or equal to/than `C1`.
diff --git a/content/fate_v1/computations/maths/_index.md b/content/fate_v1/computations/maths/_index.md
new file mode 100644
index 0000000..ef0783b
--- /dev/null
+++ b/content/fate_v1/computations/maths/_index.md
@@ -0,0 +1,58 @@
+---
+title: Mathematics
+weight: 1
+---
+
+All operands must be of the same type, which is also the type returned by the
+operation.
+
+### Addition
+{{< fatecode >}}(+ [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+
+Standard addition (minimum of 2 arguments).
+
+### Substraction
+{{< fatecode >}}(- [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+
+Standard substraction (minimum of 2 arguments).
+
+### Multiplication
+{{< fatecode >}}(* [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+
+Standard multiplication (minimum of 2 arguments).
+
+### Division
+{{< fatecode >}}(/ [N0 = NUMBER] [N1 = NUMBER]){{< /fatecode >}}
+
+Standard division. Note that a division on integers is indeed an integer
+division.
+
+### Exponent
+{{< fatecode >}}(^ [N0 = NUMBER] [N1 = NUMBER]){{< /fatecode >}}
+
+Standard exponentiation.
+
+### Modulo
+{{< fatecode >}}(% [I0 = INT] [I1 = INT]){{< /fatecode >}}
+
+Standard modulo operation.
+
+### Minimum
+{{< fatecode >}}(min [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+
+Lowest value among the operands (minimum of 2 arguments).
+
+### Maximum
+{{< fatecode >}}(max [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+
+Highest value among the operands (minimum of 2 arguments).
+
+### Clamp
+{{< fatecode >}}(clamp [N0 = NUMBER] [N1 = NUMBER] [N2 = NUMBER]){{< /fatecode >}}
+
+Equivalent to `(max N0 (min N1 N2))`.
+
+### Absolute
+{{< fatecode >}}(abs [NUMBER]){{< /fatecode >}}
+
+Positive value of `[NUMBER]`.
diff --git a/content/fate_v1/declarations/_index.md b/content/fate_v1/declarations/_index.md
deleted file mode 100644
index 97a982e..0000000
--- a/content/fate_v1/declarations/_index.md
+++ /dev/null
@@ -1,6 +0,0 @@
----
-title: "Declarations"
-menuTitle: "Declarations"
-chapter: true
-weight: 2
----
diff --git a/content/fate_v1/declarations/events/_index.md b/content/fate_v1/declarations/events/_index.md
deleted file mode 100644
index 0c00d52..0000000
--- a/content/fate_v1/declarations/events/_index.md
+++ /dev/null
@@ -1,18 +0,0 @@
----
-title: Events
----
-Events are how a Fate narrative can communicate to the interpreter that
-something which cannot be expressed in Fate needs to be performed. The execution
-is paused until the event is resolved by the interpreter. To avoid mistakes, any
-event type must be declared before use.
-
-#### EVENT
-{{< fatecode >}}(declare_event_type {string} [C0 = TYPE] ... [CN = TYPE]){{< /fatecode >}}
-**Effect:** An event with the name `{string}` and taking parameters of types
-`[C0]`, ..., `[CN]` can be used.
-
-## Examples
-* `(declare_event_type user_string_input text (ptr string))`
-* `(declare_event_type wait int)`
-* `(declare_event_type set_background_to string)`
-* `(declare_event_type rumble)`
diff --git a/content/fate_v1/declarations/types/_index.md b/content/fate_v1/declarations/types/_index.md
deleted file mode 100644
index 5844895..0000000
--- a/content/fate_v1/declarations/types/_index.md
+++ /dev/null
@@ -1,66 +0,0 @@
----
-title: Types
----
-Fate is a strongly typed language.
-
-## Base Types
-There are a few base types already defined:
-
-* `int`: an integer, which is a number *without* fractional component (e.g. `-3`, `0`, `3`).
-* `float`: a number *with* a fractional component (e.g. `-3.14`, `0.0`, `3.9931`).
-* `bool`: a Boolean (i.e. `(true)` or `(false)`).
-* `string`: a list of characters, not including newlines (e.g. `bob`,
- `something else`, `日本のもの`, or `الاشياء العربية`). This cannot include
- computations: only hardcoded strings. `(lp)` will be substituted by a `(` and
- `(rp)` by a `)`, letting you use parentheses in a string.
-
-* `text`: a list of computations, interpreted as text, which may have
- attributes.
-
-Pointers are also available:
-* `(ptr [TYPE])`: a pointer to a memory element of type `[TYPE]` (e.g. `(ptr int)`, `(ptr (ptr string))`).
-If you are not familiar with pointers, a pointer is a value corresponding to an address containing a memory element.
-Accessing the value of the pointer yields the address, accessing the value pointed to by the value of the pointer yields the memory element.
-Pointers to pointers can be made, in which case that memory element is also an address to yet another memory element.
-Pointers still have to point to a definite type. Unlike in C, you cannot create a pointer to an unspecified type.
-
-Two collection types are available:
-* `(list [TYPE])`
-* `(set [COMPARABLE TYPE])`
-
-Lambda computations are available:
-* `(lambda [R = TYPE] ([A0 = TYPE] ... [AN = TYPE]))` is a type corresponding
- to a lambda function returning a value of type `R` and taking parameters of
- types `A0` ... `AN`.
-
-Procedures/sequences can be stored for future reference:
-* `(sequence ([A0 = TYPE] ... [AN = TYPE]))` is a type corresponding
- to a procedure/sequence taking parameters of types `A0` ... `AN`.
-
-### Common Type Groupings
-* `[NUMBER]` corresponds to `int`, `float`.
-* `[COLLECTION]` corresponds to `(list [TYPE])` and `(set [COMPARABLE TYPE])`.
-* `[PRIMITIVE]` `int`, `float`, `bool`, `string`, `text`.
-* `[COMPARABLE]` corresponds to `int`, `float`, `bool`, `string`, `text`,
- and `(ptr [TYPE])`. This indicates types for which operators such as `<` are
- defined.
-
-## Defining Your Own Types
-
-### Aliasing
-{{< fatecode >}}(declare_alias_type [TYPE] {String}){{< /fatecode >}}.
-**Effect:** Declares the type `{String}`. If `[TYPE]` is not a `[PRIMITIVE]`,
- `[TYPE]` and `{String}` are now two equivalent types. If `[TYPE]` is a
- `[PRIMITIVE]`, `{String}` is a subtype of `[TYPE]`.
-
-### Structures
-{{< fatecode >}}(declare_structure_type {String} ([T0 = TYPE] {F0 = String}) ... ([TN = TYPE] {fn = String})){{< /fatecode >}}.
-
-## Examples
-
-{{< fatecode >}}(define_structure_type player
- (creature creature)
- ((list (ptr item)) inventory)
- (int money)
-)
-{{< /fatecode >}}
diff --git a/content/fate_v1/extensions/_index.md b/content/fate_v1/extensions/_index.md
deleted file mode 100644
index 6189745..0000000
--- a/content/fate_v1/extensions/_index.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-title: Extensions
-weight: 6
----
-This page not available yet, sorry.
diff --git a/content/fate_v1/declarations/files/_index.md b/content/fate_v1/files/_index.md
index 05c6836..25d818e 100644
--- a/content/fate_v1/declarations/files/_index.md
+++ b/content/fate_v1/files/_index.md
@@ -1,5 +1,7 @@
---
title: File Management
+menuTitle: Files
+weight: 7
---
Fate narratives have one main file, but this file can use the contents of other
files, and these files in turn can also use the contents of other files. Three
diff --git a/content/fate_v1/instructions/_index.md b/content/fate_v1/instructions/_index.md
index 3f86e2e..21c2103 100644
--- a/content/fate_v1/instructions/_index.md
+++ b/content/fate_v1/instructions/_index.md
@@ -1,6 +1,6 @@
---
title: Instructions
-weight: 4
+weight: 5
---
Instructions do not return values, but modify the memory in some way or
interact with the interpreter. Computations are valid instructions, and will be
diff --git a/content/fate_v1/notations/_index.md b/content/fate_v1/notations/_index.md
index 320bdbe..a29a58b 100644
--- a/content/fate_v1/notations/_index.md
+++ b/content/fate_v1/notations/_index.md
@@ -1,6 +1,5 @@
---
-title: "Notations"
-menuTitle: "Notations"
+title: Notations
weight: 1
---
diff --git a/content/fate_v1/declarations/sequences/_index.md b/content/fate_v1/sequences/_index.md
index a2fbcb1..6b2bafe 100644
--- a/content/fate_v1/declarations/sequences/_index.md
+++ b/content/fate_v1/sequences/_index.md
@@ -1,5 +1,7 @@
---
title: Sequences and Procedures
+menuTitle: Sequences
+weight: 6
---
Sequences and procedures are the same thing. These are named lists of
instructions and values, which can be called upon at any point where
diff --git a/content/fate_v1/declarations/text_effects/_index.md b/content/fate_v1/text_effects/_index.md
index fd3742d..63876e8 100644
--- a/content/fate_v1/declarations/text_effects/_index.md
+++ b/content/fate_v1/text_effects/_index.md
@@ -1,5 +1,6 @@
---
title: Text Effects
+weight: 8
---
Text effects are attributes that can be given to text elements. The
effects themselves can take parameters. To avoid errors that would be difficult
diff --git a/content/fate_v1/types/_index.md b/content/fate_v1/types/_index.md
new file mode 100644
index 0000000..b778383
--- /dev/null
+++ b/content/fate_v1/types/_index.md
@@ -0,0 +1,193 @@
+---
+title: Types
+weight: 2
+---
+
+Fate is a strongly typed language. All values have a well defined type. All
+variables and parameters are assigned a type which cannot be changed.
+
+### Numbers
+There are two types corresponding to numbers: `int` and `float`.
+
+The `int` type corresponds to an integer, which is a number *without*
+fractional component. Examples of `[INT]` values include:
+* {{< fatecode >}}42{{< /fatecode >}}
+* {{< fatecode >}}-4{{< /fatecode >}}
+* {{< fatecode >}}(+ 63 -5 1 8 9 (- 22 0 1 3)){{< /fatecode >}}
+* {{< fatecode >}}(/ 3 2){{< /fatecode >}}
+
+The `float` type corresponds to a number *with* a fractional component. Examples
+of `[FLOAT]` values include:
+* {{< fatecode >}}42.0{{< /fatecode >}}
+* {{< fatecode >}}69.4201773{{< /fatecode >}}
+* {{< fatecode >}}(+ 63.25 9.8 0.2224 (- 0.11 0.9 .99993)){{< /fatecode >}}
+* {{< fatecode >}}(/ 3.0 2.0){{< /fatecode >}}
+
+This documentation uses the `[NUMBER]` notation to indicate values that can
+be either `[FLOAT]` or `[INT]`.
+
+### Booleans
+The `bool` type corresponds to Booleans. This type only accepts two values:
+`(true)` and `(false)`.
+
+Examples of `[BOOL]` values include:
+* {{< fatecode >}}(true){{< /fatecode >}}
+* {{< fatecode >}}(and (false) (true) (false)){{< /fatecode >}}
+* {{< fatecode >}}(or (false) (true) (false)){{< /fatecode >}}
+* {{< fatecode >}}(one_in (false) (true) (false)){{< /fatecode >}}
+
+### Texts and Strings
+Things get a bit more complicated when handling texts and strings. There are two
+types here `string` and `text`.
+
+The `string` type corresponds to string constants. Nothing can be added to a
+`string` value. Its use is fairly limited. The main point of the `string` type
+being that it is comparable and thus a good way to handle tags (e.g. testing
+for player progress by having a set of `[STRING]` values corresponding to what
+has been done so far).
+
+Examples of `[STRING]` include:
+* {{< fatecode >}}something like this{{< /fatecode >}}
+* {{< fatecode >}}日本のもの{{< /fatecode >}}
+* {{< fatecode >}}لاشياء العربية{{< /fatecode >}}
+* {{< fatecode >}}There are forty two (lp)42(rp) things there...{{< /fatecode >}}
+* {{< fatecode >}}9 + x = 3 is an equation.{{< /fatecode >}}
+
+The `text` corresponds to trees of computations interpreted as text and to which
+attributes can be added. In simpler terms: it's text. If the use of comparable
+values is not needed, `text` is the type to use for text.
+Examples of `[TEXT]` include:
+* Every example of `[STRING]`.
+* {{< fatecode >}}There are (+ 32 44 11 4) eggs in that basket.{{< /fatecode >}}
+* {{< fatecode >}}There are (text_effect italics (+ 32 44 11 4) eggs) in that basket!{{< /fatecode >}}
+* {{< fatecode >}}There are (text_effect italics (+ 32 44 11 4) (text_effect bold eggs)) in that basket!{{< /fatecode >}}
+* {{< fatecode >}}(newline)- This!{{< /fatecode >}}
+
+### Pointers
+A pointer is a value corresponding to the address of a memory element.
+Accessing the value of the pointer yields the address, accessing the value
+pointed to by the value of the pointer yields the memory element. Pointers
+still have to point to a specific type: unlike in C, you cannot create a pointer
+to an unspecified type.
+
+In effect, a pointer to a memory element of type `{TYPE}` is written as
+`(ptr {TYPE})`.
+
+Examples of pointer types:
+* {{< fatecode >}}(ptr int){{< /fatecode >}}
+* {{< fatecode >}}(ptr (ptr int)){{< /fatecode >}}
+* {{< fatecode >}}(ptr text){{< /fatecode >}}
+* {{< fatecode >}}(ptr (cons int sequence)){{< /fatecode >}}
+
+### Collections
+Collections are memory elements containing any number of elements of a given
+type. Two types of collections are available in Fate: lists and sets.
+
+Lists are basic collections in which the order of the elements is fully
+controlled by the user. The `(list {TYPE})` type indicates a list of `{TYPE}`.
+
+Examples of list types:
+* {{< fatecode >}}(list int){{< /fatecode >}}
+* {{< fatecode >}}(list (list (ptr int))){{< /fatecode >}}
+* {{< fatecode >}}(list (cons (list int) (set int))){{< /fatecode >}}
+
+Examples of lists:
+* {{< fatecode >}}(range 0 10 1){{< /fatecode >}}
+* {{< fatecode >}}(add 0 1 2 3 4 (default (list int))){< /fatecode >}}
+* {{< fatecode >}}(add_all (range 0 10 1) (range -10 -1 1)){{< /fatecode >}}
+
+Sets are collections of elements with a comparable type. The comparables types,
+noted `[COMPARABLE]` are `int`, `float`, `bool`, `string`, `sequence`, `lambda`,
+and `ptr`. This corresponds to types for which operators such as `<` are
+defined. Sets cannot have duplicate members, and their elements are ordered in
+a specific way in order to more quickly test if a value is present. the
+`(set {COMPARABLE TYPE})` indicates a set of elements of type
+`{COMPARABLE TYPE}`.
+
+Examples of set types:
+* {{< fatecode >}}(set int){{< /fatecode >}}
+* {{< fatecode >}}(set (lambda int (int (list text)))){{< /fatecode >}}
+* {{< fatecode >}}(set string){{< /fatecode >}}
+
+Examples of sets:
+* {{< fatecode >}}(add 6 1 4 2 900 (default (set int))){< /fatecode >}}
+* {{< fatecode >}}(add_all (range 0 10 1) (set int)){{< /fatecode >}}
+
+### Lambda Expressions
+Lambda expressions are similar to a computation that is stored for later use.
+This can have different uses, such as applying the same computation on a
+collection of elements or storing a recurrent computation with a value that
+changes over time.
+
+The lambda expression itself is a computation, so it has a type (not to be
+confused with the type of value returned by the expression when it is computed).
+
+Lambda expression types are noted
+`(lambda {R = TYPE} ({A0 = TYPE} ... {AN = TYPE}))`, with `{R}` being the type
+of value returned by the expression and `{A0}` ... `{AN}` being the type of
+each of its parameters.
+
+Examples of lambda expression types:
+* {{< fatecode >}}(lambda int ()){{< /fatecode >}}
+* {{< fatecode >}}(lambda int (int (list text))){{< /fatecode >}}
+* {{< fatecode >}}(lambda (lambda int ()) (int string)){{< /fatecode >}}
+
+Examples of lambda expressions:
+* {{< fatecode >}}(lambda ((int i)) (+ i 1)){{< /fatecode >}}
+* {{< fatecode >}}(lambda ((int i) (int j)) (max j (+ i 2))){{< /fatecode >}}
+* {{< fatecode >}}(lambda
+ ((string s) (int i) (int j))
+ (if (= (var s) zero)
+ 0
+ (* j (+ i 2))
+ )
+){{< /fatecode >}}
+
+### Sequences and Procedures
+It is possible to use values that correspond to a sequence or a procedure.
+The type `(sequence ({A0 = TYPE} ... {AN = TYPE}))` corresponds to a sequence
+or procedure taking parameters of types `{A0}` ... `{AN}`.
+
+Examples of procedure types:
+* {{< fatecode >}}(sequence ()){{< /fatecode >}}
+* {{< fatecode >}}(sequence (int int)){{< /fatecode >}}
+* {{< fatecode >}}(sequence (float string int)){{< /fatecode >}}
+
+Examples of computations returning a sequence or procedure value:
+* {{< fatecode >}}(sequence my_seq_name){{< /fatecode >}}
+* {{< fatecode >}}(sequence my_other_seq_name){{< /fatecode >}}
+
+### Common Type Groupings
+* `[NUMBER]` corresponds to `[INT]` or `[FLOAT]`.
+* `[COLLECTION]` corresponds to `[LIST]` or `[set]`.
+* `[PRIMITIVE]` corresponds to `[INT]`, `[FLOAT]`, `[BOOL]`, `[STRING]`,
+ or `[TEXT]`.
+* `[COMPARABLE]` corresponds to `[INT]`, `[FLOAT]`, `[BOOL]`, `[STRING]`,
+ `[SEQUENCE]`, `[LAMBDA]`, or `[PTR]`.
+
+## Defining Your Own Types
+
+### Aliasing
+{{< fatecode >}}(declare_alias_type {TYPE} {IDENTIFIER}){{< /fatecode >}}.
+**Effect:** Declares the type `{IDENTIFIER}`.
+
+* If `{TYPE}` is not a `[PRIMITIVE]`: `{TYPE}` and `{IDENTIFIER}` are now two
+ equivalent types.
+
+* If `{TYPE}` is a `[PRIMITIVE]`, `{IDENTIFIER}` is a subtype of `{TYPE}`. Given
+ `T0` and `T1` two types, such that `T1` is a subtype of `T0`, `T1` can be used
+ as a `T0`, but `T0` cannot be used as `T1`.
+
+### Structures
+{{< fatecode >}}(declare_structure_type {IDENTIFIER}
+ ({T0 = TYPE} {F0 = IDENTIFIER})
+ ...
+ ({TN = TYPE} {FN = IDENTIFIER})
+){{< /fatecode >}}.
+
+{{< fatecode >}}(define_structure_type player
+ (creature creature)
+ ((list (ptr item)) inventory)
+ (int money)
+)
+{{< /fatecode >}}
diff --git a/content/fate_v1/declarations/variables/_index.md b/content/fate_v1/variables/_index.md
index 153135c..a182dd0 100644
--- a/content/fate_v1/declarations/variables/_index.md
+++ b/content/fate_v1/variables/_index.md
@@ -1,5 +1,6 @@
---
title: Variables
+weight: 3
---
Variables are what hold values. Each variable has a type, which cannot be
changed.