summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'content/fate_v1')
-rw-r--r--content/fate_v1/computations/addresses/_index.md25
-rw-r--r--content/fate_v1/computations/basics/_index.md137
-rw-r--r--content/fate_v1/computations/collections/_index.md243
-rw-r--r--content/fate_v1/computations/conditionals/_index.md13
-rw-r--r--content/fate_v1/computations/lambda_functions/_index.md13
-rw-r--r--content/fate_v1/computations/text/_index.md5
-rw-r--r--content/fate_v1/extensions/_index.md15
-rw-r--r--content/fate_v1/instructions/_index.md5
-rw-r--r--content/fate_v1/instructions/addresses/_index.md6
-rw-r--r--content/fate_v1/instructions/collections/_index.md160
-rw-r--r--content/fate_v1/instructions/conditionals/_index.md22
-rw-r--r--content/fate_v1/instructions/loops/_index.md28
-rw-r--r--content/fate_v1/instructions/player_choices/_index.md16
-rw-r--r--content/fate_v1/notations/_index.md21
14 files changed, 492 insertions, 217 deletions
diff --git a/content/fate_v1/computations/addresses/_index.md b/content/fate_v1/computations/addresses/_index.md
index aafd0f1..ae052ca 100644
--- a/content/fate_v1/computations/addresses/_index.md
+++ b/content/fate_v1/computations/addresses/_index.md
@@ -1,18 +1,27 @@
---
title: Addresses
---
-### VALUE ACCESS
-{{< fatecode >}}(at [ADDRESS]){{< /fatecode >}}
-Returns the variable at `[ADDRESS]`.
+Addresses are values that indicate where in the memory some other value is
+located. They can thus be used to pass around an indication of where to modify
+a value.
+
+### VALUE ACCESS
+{{< fatecode >}}(at [address: (POINTER X)]){{< /fatecode >}}
+Returns the `[X]` value at `[address]`. The returned value can act as a
+reference.
-### ALLOCATION
-{{< fatecode >}}(new [TYPE]){{< /fatecode >}}
+**Examples:** `(at my_ptr_var)`, `(at (ptr my_var))`
-Returns the address of a new variable of type `[TYPE]`. Don't forget to call
-`free` on it once you're done.
+**Aliases:** `at`.
### ADDRESS
-{{< fatecode >}}(ptr [COMPUTATION VARIABLE]){{< /fatecode >}}
+{{< fatecode >}}(ptr [X]){{< /fatecode >}}
Returns the address of `[COMPUTATION VARIABLE]`.
+
+**Examples:** `(ptr my_var)`
+
+**Aliases:** `address_of`, `addressof`, `addressOf`, `address`, `addr`,
+`pointer_to`, `pointerto`, `pointerTo`, `pointer`, `ptr`, `reference_to`,
+`referenceto`, `referenceTo`, `reference`, `ref`.
diff --git a/content/fate_v1/computations/basics/_index.md b/content/fate_v1/computations/basics/_index.md
index e8a8816..52b5e42 100644
--- a/content/fate_v1/computations/basics/_index.md
+++ b/content/fate_v1/computations/basics/_index.md
@@ -2,19 +2,44 @@
title: Computations
weight: 2
---
-Computations are values. They may read from the memory, but do not modify it
-(with a single exception).
+Computations are values. They may read from the memory, but do not modify it.
### TEXT
-{{< fatecode >}}(text [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}}
+{{< fatecode >}}(text [C0: COMPUTATION]...[CN: COMPUTATION]){{< /fatecode >}}
-Returns a `text` node containing the text representation of `C0` ... `CN`.
+Returns a `text` value containing the text representation of `C0`...`CN`.
+
+**Examples:** `(text just a few strings)`,
+`(text (string just a single string))`, `(text There are (+ 3 1) lights!)`,
+`(text (text (text well...)))`.
+
+**Aliases:** `text`.
### 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}`.
+applicable. In cases where no `text` or `string` value is expected, using
+`{String}` instead of `(var {String})` will work as a shortcut.
+
+Structure members can be accessed by using `.` in `{String}`. Collection
+(`list` or `set`) elements can be similarly accessed by their index.
+
+**Examples:** `(var my_list)`, `(var my_list.0)`, `(var my_list.0.name)`.
+
+**Aliases:** `var`, `variable`.
+
+### STRING
+{{< fatecode >}}(string {String}){{< /fatecode >}}
+
+Returns a `string` value corresponding to `{String}`. This can be used
+to disambiguate strings and variable names, as well as to create strings with
+spaces.
+
+**Examples:**
+`(string just a single string)`, `(string var0_is_not_a_var)`
+
+**Aliases:** `string`.
### SEQUENCE | PROCEDURE
{{< fatecode >}}(sequence {String}){{< /fatecode >}}
@@ -22,21 +47,42 @@ applicable. Structure members can be accessed by using `.` in `{String}`.
Returns a `[SEQUENCE]` value corresponding to the sequence named `{String}`.
Said sequence can be defined at a later point.
+**Examples:** `(sequence the_cave)`, `(sequence end_credits)`.
+
+**Aliases:** `seq`, `sequence`.
+
+
### STRUCTURE FIELD ACCESS
-{{< fatecode >}}{Structure Var Name}.{Field Name}{{< /fatecode >}}
-{{< fatecode >}}(field {String} [STRUCTURE VAR]){{< /fatecode >}}
+{{< fatecode >}}{Structure Variable Name}.{Field Name}{{< /fatecode >}}
+{{< fatecode >}}(struct:field {String} [STRUCTURE]){{< /fatecode >}}
-Accesses the `{String}` field of the structure `[STRUCTURE VAR]`. Using `.` to
-access fields is recommended over the use of this operator.
+Accesses the `{String}` field of the structure `[STRUCTURE]`. Using `.` to
+access fields is recommended over the use of this operator when possible. The
+returned value can act as a reference.
+
+**Examples:** `claude.health_points`, `(struct:field health_points jack)`,
+`(struct:field stamina (car (list:pop_left character_list)))`
+
+**Aliases:** `struct:field`, `struct:get`, `struct:getfield`,
+`struct:get_field`.
-### 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 >}}
+{{< fatecode >}}(let
+ (
+ ({V0: String} [C0: COMPUTATION])
+ ...
+ ({VN: String} [CN: COMPUTATION])
+ )
+ [result: COMPUTATION]
+){{< /fatecode >}}
+
+Defines a hierarchical level and local variables `V0` ... `VN` with values `C0` ... `CN`, and returns the value of `result`.
+
+**Examples:**
+
+**Aliases:**
-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 >}}
@@ -49,18 +95,28 @@ allowed:
* `[BOOL]` to `[BOOL]` and `[STRING]`.
* `[STRING]` to `[BOOL]` (`true` and `false`), `[FLOAT]`, `[INT]`, and`[STRING]`.
+**Examples:**
+
+**Aliases:**
+
+
### RANDOM NUMBER
-{{< fatecode >}}(rand [I0 = INT] [IN = INT]){{< /fatecode >}}
+{{< fatecode >}}(rand [I0: INT] [IN: INT]){{< /fatecode >}}
Returns a random number between `I0` and `IN` (inclusive).
+**Examples:**
+
+**Aliases:**
+
+
## Basic Operators
### BOOL OPERATORS
-{{< fatecode >}}(and [B0 = BOOL] ... [BN = BOOL]){{< /fatecode >}}
+{{< fatecode >}}(and [B0: BOOL] ... [BN: BOOL]){{< /fatecode >}}
Standard conjunction (minimum of 2 arguments).
-{{< fatecode >}}(or [B0 = BOOL] ... [BN = BOOL]){{< /fatecode >}}
+{{< fatecode >}}(or [B0: BOOL] ... [BN: BOOL]){{< /fatecode >}}
Standard disjunction (minimum of 2 arguments).
@@ -68,53 +124,58 @@ Standard disjunction (minimum of 2 arguments).
Standard negation.
-{{< fatecode >}}(implies [B0 = BOOL] [B1 = BOOL]){{< /fatecode >}}
+{{< fatecode >}}(implies [B0: BOOL] [B1: BOOL]){{< /fatecode >}}
Standard implication.
-{{< fatecode >}}(one_in [B0 = BOOL] ... [BN = BOOL]){{< /fatecode >}}
+{{< fatecode >}}(one_in [B0: BOOL] ... [BN: BOOL]){{< /fatecode >}}
true if, and only if, exactly one of the operands is true.
+**Examples:**
+
+**Aliases:**
+
+
### 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 >}}
+{{< fatecode >}}(+ [N0: NUMBER] ... [NN: NUMBER]){{< /fatecode >}}
Standard addition (minimum of 2 arguments).
-{{< fatecode >}}(- [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+{{< fatecode >}}(- [N0: NUMBER] ... [NN: NUMBER]){{< /fatecode >}}
Standard substraction (minimum of 2 arguments).
-{{< fatecode >}}(* [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+{{< fatecode >}}(* [N0: NUMBER] ... [NN: NUMBER]){{< /fatecode >}}
Standard multiplication (minimum of 2 arguments).
-{{< fatecode >}}(/ [N0 = NUMBER] [N1 = NUMBER]){{< /fatecode >}}
+{{< 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 >}}
+{{< fatecode >}}(^ [N0: NUMBER] [N1: NUMBER]){{< /fatecode >}}
Standard exponentiation.
-{{< fatecode >}}(% [I0 = INT] [I1 = INT]){{< /fatecode >}}
+{{< fatecode >}}(% [I0: INT] [I1: INT]){{< /fatecode >}}
Standard modulo operation.
-{{< fatecode >}}(min [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+{{< fatecode >}}(min [N0: NUMBER] ... [NN: NUMBER]){{< /fatecode >}}
Lowest value among the operands.
-{{< fatecode >}}(max [N0 = NUMBER] ... [NN = NUMBER]){{< /fatecode >}}
+{{< fatecode >}}(max [N0: NUMBER] ... [NN: NUMBER]){{< /fatecode >}}
Highest value among the operands.
-{{< fatecode >}}(clamp [N0 = NUMBER] [N1 = NUMBER] [N2 = NUMBER]){{< /fatecode >}}
+{{< fatecode >}}(clamp [N0: NUMBER] [N1: NUMBER] [N2: NUMBER]){{< /fatecode >}}
Equivalent to `(max N0 (min N1 N2))`.
@@ -123,23 +184,33 @@ Equivalent to `(max N0 (min N1 N2))`.
Positive value of `[NUMBER]`.
+**Examples:**
+
+**Aliases:**
+
+
### COMPARISON OPERATORS
-{{< fatecode >}}(= [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}}
+{{< fatecode >}}(= [C0: COMPUTATION] ... [CN: COMPUTATION]){{< /fatecode >}}
True if, and only if, all operands are equal.
-{{< fatecode >}}(< [C0 = COMPARABLE] [C1 = COMPARABLE]){{< /fatecode >}}
+{{< fatecode >}}(< [C0: COMPARABLE] [C1: COMPARABLE]){{< /fatecode >}}
True if, and only if, `C0` is strictly lower than `C1`.
-{{< fatecode >}}(=< [C0 = COMPARABLE] [C1 = COMPARABLE]){{< /fatecode >}}
+{{< 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 >}}
+{{< fatecode >}}(> [C0: COMPARABLE] [C1: COMPARABLE]){{< /fatecode >}}
True if, and only if, `C0` is strictly higher than `C1`.
-{{< fatecode >}}(>= [C0 = COMPARABLE] [C1 = COMPARABLE]){{< /fatecode >}}
+{{< fatecode >}}(>= [C0: COMPARABLE] [C1: COMPARABLE]){{< /fatecode >}}
True if, and only if, `C0` is higher or equal to/than `C1`.
+
+**Examples:**
+
+**Aliases:**
+
diff --git a/content/fate_v1/computations/collections/_index.md b/content/fate_v1/computations/collections/_index.md
index 80a4ead..584baef 100644
--- a/content/fate_v1/computations/collections/_index.md
+++ b/content/fate_v1/computations/collections/_index.md
@@ -2,151 +2,208 @@
title: Collections
---
### ACCESS
-{{< fatecode >}}(access [INT] [COLLECTION|COLLECTION PTR]){{< /fatecode >}}
+{{< fatecode >}}(list:access [INT] [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:access [INT] [SET]){{< /fatecode >}}
-Returns the value of the `[INT]`th element in `[COLLECTION|COLLECTION PTR]`.
+Returns the value of the `[INT]`th element in the collection.
### ACCESS CONSTANT INDEX
-{{< fatecode >}}[(COLLECTION|COLLECTION PTR) VAR].{Integer}{{< /fatecode >}}
+{{< fatecode >}}[(LIST) VAR].{Integer}{{< /fatecode >}}
+{{< fatecode >}}[(SET) VAR].{Integer}{{< /fatecode >}}
-Returns a variable corresponding to the `[INT]`th element in
-`[(COLLECTION|COLLECTION PTR) VAR]`.
-
-### ACCESS POINTER
-{{< fatecode >}}(access_pointer [INT] [(COLLECTION|COLLECTION PTR) VAR]){{< /fatecode >}}
-
-Returns a pointer to the `[INT]`th element in `[(COLLECTION|COLLECTION PTR)
-VAR]`.
+Returns a variable corresponding to the `[INT]`th element in the collection.
### ADD ELEMENT AT
-{{< fatecode >}}(add_element_at [INT] [COMPUTATION*] [LIST]){{< /fatecode >}}
+{{< fatecode >}}(list:add_element_at [INT] [COMPUTATION*] [LIST]){{< /fatecode >}}
Returns a copy of `[LIST]` with `[COMPUTATION*]` added at index `[INT]`. Note
-that `[COMPUTATION*]` does not allow use of the variable shorthand.
+that `[COMPUTATION*]` does not allow use of the variable shorthand if `[LIST]`
+is a list of strings.
### ADD ELEMENT
-{{< fatecode >}}(add_element [C0 = COMPUTATION*] ... [CN = COMPUTATION*] [COLLECTION]){{< /fatecode >}}
+{{< fatecode >}}(list:add_element [C0 = COMPUTATION*] ... [CN = COMPUTATION*] [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:add_element [C0 = COMPUTATION*] ... [CN = COMPUTATION*] [SET]){{< /fatecode >}}
Returns a copy of `[COLLECTION]` with `C0` ... `CN` added. If `[COLLECTION]`
is a `[LIST]`, then the elements are added at the end of the list, in order
(meaning that `CN` will be the last element added).
-Note that `[COMPUTATION*]` does not allow use of the variable shorthand.
+Note that `[COMPUTATION*]` does not allow use of the variable shorthand if the
+collection is a collection of strings.
### ADDING MEMBERS
-{{< fatecode >}}(add_all_elements [C0 = COLLECTION] [C1 = COLLECTION]){{< /fatecode >}}
+{{< fatecode >}}(list:add_all_elements [C0 = LIST|SET]+ [C1 = LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:add_all_elements [C0 = LIST|SET]+ [C1 = SET]){{< /fatecode >}}
-Returns a copy of `[C1]`, with all the elements of `[C2]` added. If `[C1]`
+Returns a copy of `[C1]`, with all the elements of `[C0]` added. If `[C1]`
is a `[LIST]`, the new members are added at the end of the list.
+As a shorthand, multiple `[C0]` can be specified. They will all be added in
+order.
+
+### SUB-LIST
+{{< fatecode >}}(list:sublist [start: INT] [end_before: INT] [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:subset [start: INT] [end_before: INT] [SET]){{< /fatecode >}}
+
+Returns a copy of the collection in which only the elements with an index
+higher or equal to `[start]` and strictly less than `[end_before]` are included.
+
+### SHUFFLE
+{{< fatecode >}}(list:shuffle [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:shuffle [SET]){{< /fatecode >}}
+
+Returns a list containing all the elements of the collection in a random order.
+
### COUNT
-{{< fatecode >}}(count [COMPUTATION*] [COLLECTION]){{< /fatecode >}}
+{{< fatecode >}}(list:count [COMPUTATION*] [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:count [COMPUTATION*] [SET]){{< /fatecode >}}
-Returns the number of occurrences of `[COMPUTATION*]` in `[COLLECTION]`.
-Note that `[COMPUTATION*]` does not allow use of the variable shorthand.
+Returns the number of occurrences of `[COMPUTATION*]` in `[LIST]` or `[SET]`.
+Note that `[COMPUTATION*]` does not allow use of the variable shorthand if
+the collection is a collection of strings.
### INDEX OF
-{{< fatecode >}}(index_of [COMPUTATION] [COLLECTION]){{< /fatecode >}}
+{{< fatecode >}}(list:index_of [COMPUTATION] [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:index_of [COMPUTATION] [SET]){{< /fatecode >}}
-Returns the index of the first occurrence of `[COMPUTATION]` in `[COLLECTION]`,
-starting at 0.
+Returns the index of the first occurrence of `[COMPUTATION]` in `[LIST]` or
+`[SET]`, starting at 0.
### IS MEMBER
-{{< fatecode >}}(is_member [COMPUTATION] [COLLECTION]){{< /fatecode >}}
+{{< fatecode >}}(list:is_member [COMPUTATION] [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:is_member [COMPUTATION] [SET]){{< /fatecode >}}
-Returns true if, and only if, `[COMPUTATION]` is in `[COLLECTION]`.
+Returns true if, and only if, `[COMPUTATION]` is in `[LIST]` or `[SET]`.
### SIZE
-{{< fatecode >}}(size [COLLECTION]){{< /fatecode >}}
+{{< fatecode >}}(list:size [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:size [SET]){{< /fatecode >}}
-Returns the size (`[INT]`) of `[COLLECTION]`.
+Returns the size (`[INT]`) of `[LIST]` or `[SET]`.
### IS EMPTY
-{{< fatecode >}}(is_empty [COLLECTION]){{< /fatecode >}}
+{{< fatecode >}}(list:is_empty [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:is_empty [SET]){{< /fatecode >}}
+
+Returns true if, and only if `[LIST]` or `[SET]` is empty.
+
+### REMOVE ONE COPY
+{{< fatecode >}}(list:remove [COMPUTATION*]+ [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:remove [COMPUTATION*]+ [SET]){{< /fatecode >}}
+
+Returns a copy of the collection with one instance of `[COMPUTATION*]` having been removed. The variable shorthand cannot be used if the collection is a collection of strings.
+
+As a shorthand, multiple computations can be specified. They will all be removed
+in order.
+
+### REMOVE ALL COPIES
+{{< fatecode >}}(list:remove_each [COMPUTATION*]+ [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:remove_each [COMPUTATION*]+ [SET]){{< /fatecode >}}
+
+Returns a copy of the collection with all instances of `[COMPUTATION*]` having been removed. The variable shorthand cannot be used if the collection is a collection of strings.
+
+As a shorthand, multiple computations can be specified. They will all be removed
+from the list.
+
+### REMOVE ALL ALSO IN
+{{< fatecode >}}(list:remove_all [removed: COLLECTION]+ [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:remove_all [removed: COLLECTION]+ [SET]){{< /fatecode >}}
+
+Returns a copy of the collection with all elements of `[removed]` having been
+removed.
+
+As a shorthand, multiple `[removed]` can be specified. Their elements will all
+be removed.
+
+### REMOVE AT
+{{< fatecode >}}(list:remove_at [INT] [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:remove_at [INT] [SET]){{< /fatecode >}}
+
+Returns a copy of the collection with the element at index `[INT]` having been
+removed.
+
+### PUSH ELEMENT
+{{< fatecode >}}(list:push_left [COMPUTATION*] [LIST]){{< /fatecode >}}
+{{< fatecode >}}(list:push_right [COMPUTATION*] [LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:push_left [COMPUTATION*] [SET]){{< /fatecode >}}
+{{< fatecode >}}(set:push_right [COMPUTATION*] [SET]){{< /fatecode >}}
+
+Returns a list corresponding to the given `[LIST]` or `[SET]` to which the
+`[COMPUTATION*]` has been added to the right (`push_right`) or the left
+(`push_left`).
+
+### POP ELEMENT
+TODO
+
+### PARTITION
+TODO
+
+### PARTITION (INDEXED)
+TODO
-Returns true if, and only if `[COLLECTION]` is empty.
+### SORT
+TODO
### FILTER ELEMENTS
-{{< fatecode >}}(filter [LAMBDA BOOL (X)] [X COLLECTION]){{< /fatecode >}}
-{{< fatecode >}}(filter [LAMBDA BOOL (X Y0 ... YN)] [X COLLECTION] [Y0 COMPUTATION*] ... [YN COMPUTATION*]){{< /fatecode >}}
+{{< fatecode >}}(list:filter [LAMBDA BOOL (X)] [X LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:filter [LAMBDA BOOL (X)] [X SET]){{< /fatecode >}}
-Returns a copy of `[X COLLECTION]` in which only the elements for which
-`[LAMBDA BOOL (X)]` returns `true` remain. If the lambda function needs extra
-parameters, use the second syntax, which adds those parameters at the end of the
-`(filter ...)` call. Note that the variable shorthand cannot be used for these
-extra parameters.
+Returns a copy of `[X LIST]` or `[X SET]` in which only the elements for which
+`[LAMBDA BOOL (X)]` returns `true` remain.
### FILTER ELEMENTS (INDEXED)
-{{< fatecode >}}(indexed_filter [LAMBDA BOOL (INT X)] [X COLLECTION]){{< /fatecode >}}
-{{< fatecode >}}(indexed_filter [LAMBDA BOOL (INT X Y0 ... YN)] [X COLLECTION] [Y0 COMPUTATION*] ... [YN COMPUTATION*]){{< /fatecode >}}
+{{< fatecode >}}(list:indexed_filter [LAMBDA BOOL (INT X)] [X LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:indexed_filter [LAMBDA BOOL (INT X)] [X SET]){{< /fatecode >}}
-Returns a copy of `[INT X COLLECTION]` in which only the elements for which
+Returns a copy of `[X LIST]` or `[X SET]` in which only the elements for which
`[LAMBDA BOOL (INT X)]` (with `INT` being the element's index) returns `true`
-remain. If the lambda function needs extra parameters, use the second syntax,
-which adds those parameters at the end of the `(indexed_filter ...)` call. Note
-that the variable shorthand cannot be used for these extra parameters.
+remain.
### FOLD OVER COLLECTION
-{{< fatecode >}}(foldl [LAMBDA X (X Y)] [X COMPUTATION*] [Y COLLECTION]){{< /fatecode >}}
-{{< fatecode >}}(foldl [LAMBDA X (X Y Z0 ... ZN)] [X COMPUTATION*] [Y COLLECTION] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
-{{< fatecode >}}(foldr [LAMBDA X (X Y)] [X COMPUTATION*] [Y COLLECTION]){{< /fatecode >}}
-{{< fatecode >}}(foldr [LAMBDA X (X Y Z0 ... ZN)] [X COMPUTATION*] [Y COLLECTION] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
+{{< fatecode >}}(list:foldl [LAMBDA X (X Y)] [X COMPUTATION*] [Y LIST]){{< /fatecode >}}
+{{< fatecode >}}(list:foldr [LAMBDA X (X Y)] [X COMPUTATION*] [Y LIST]){{< /fatecode >}}
+{{< fatecode >}}(set:foldl [LAMBDA X (X Y)] [X COMPUTATION*] [Y SET]){{< /fatecode >}}
+{{< fatecode >}}(set:foldr [LAMBDA X (X Y)] [X COMPUTATION*] [Y SET]){{< /fatecode >}}
Returns the result of iterating `[LAMBDA X (X Y)]` over `[Y COLLECTION]`, with
`[X COMPUTATION*]` being the initial value. The direction of the iteration is
by ascending index order when using `foldl`, and the opposite order when using
-`foldr`. Extra parameters for the lambda function can be passed as extra
-parameters of the call. Note that the variable shorthand cannot be used for
-those extra parameters, nor for the initial value.
+`foldr`. The variable shorthand cannot be used for the initial value if the
+lambda function returns a string.
### MERGE COLLECTIONS
-{{< fatecode >}}(merge_to_list [LAMBDA O (X Y)] [X COLLECTION] [Y COLLECTION]){{< /fatecode >}}
-{{< fatecode >}}(merge_to_list [LAMBDA O (X Y Z0 ... ZN)] [X COLLECTION] [Y COLLECTION] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
-{{< fatecode >}}(merge_to_set [LAMBDA O (X Y)] [X COLLECTION] [Y COLLECTION]){{< /fatecode >}}
-{{< fatecode >}}(merge_to_set [LAMBDA O (X Y Z0 ... ZN)] [X COLLECTION] [Y COLLECTION] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
-Merges two collections into either a list or a set. This version of merging
-only continues as long as both collections have elements. Thus, extra elements
-in either list are ignored. Extra parameters for the lambda function can be
-passed as extra parameters of the call. Note that the variable shorthand cannot
-be used for those extra parameters.
+{{< fatecode >}}(list:merge [LAMBDA O (X Y)] [X LIST|X SET] [Y LIST|Y SET]){{< /fatecode >}}
+{{< fatecode >}}(set:merge [LAMBDA O (X Y)] [X LIST|X SET] [Y LIST|Y SET]){{< /fatecode >}}
+Merges two collections into either a list (`list:merge`) or a set
+(`set:merge`). This version of merging only continues as long as both
+collections have elements. Thus, extra elements in either list are ignored.
### SAFE-MERGE COLLECTIONS
-{{< fatecode >}}(safe_merge_to_list [LAMBDA O (X Y)] [X COMPUTATION*] [X COLLECTION] [Y COMPUTATION*] [Y COLLECTION]){{< /fatecode >}}
-{{< fatecode >}}(safe_merge_to_list [LAMBDA O (X Y Z0 ... ZN)] [X COMPUTATION*] [X COLLECTION] [Y COMPUTATION*] [Y COLLECTION] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
-{{< fatecode >}}(safe_merge_to_set [LAMBDA O (X Y)] [X COLLECTION] [X COMPUTATION*] [Y COLLECTION] [Y COMPUTATION*]){{< /fatecode >}}
-{{< fatecode >}}(safe_merge_to_set [LAMBDA O (X Y Z0 ... ZN)] [X COLLECTION] [X COMPUTATION*] [Y COLLECTION] [Y COMPUTATION*] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
-Merges two collections into either a list or a set. This version of merging
-continues as long as either collection has elements. Hence the extra two
-parameters compared to the non-safe version: these correspond to the value used
-for the lambda when a collection has ran out of elements but the other has not.
-Extra parameters for the lambda function can be passed as extra parameters of
-the call. Note that the variable shorthand cannot be used for those extra
-parameters.
+{{< fatecode >}}(list:safe_merge [LAMBDA O (X Y)] [X LIST|X SET] [X COMPUTATION] [Y LIST|Y SET] [Y COMPUTATION]){{< /fatecode >}}
+{{< fatecode >}}(set:safe_merge [LAMBDA O (X Y)] [X LIST|X SET] [X COMPUTATION] [Y LIST|Y SET] [Y COMPUTATION]){{< /fatecode >}}
+Safely merges two collections into either a list (`list:safe_merge`) or a set
+(`set:safe_merge`). This version of merging continues as long as either
+collection has elements. If one of the two collections runs out of elements
+before the other, it uses the provided default value (`[X COMPUTATION]` for the
+first list, `[Y COMPUTATION]` for the second one).
### MERGE COLLECTIONS (INDEXED)
-{{< fatecode >}}(indexed_merge_to_list [LAMBDA O (INT X Y)] [X COLLECTION] [Y COLLECTION]){{< /fatecode >}}
-{{< fatecode >}}(indexed_merge_to_list [LAMBDA O (INT X Y Z0 ... ZN)] [X COLLECTION] [Y COLLECTION] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
-{{< fatecode >}}(indexed_merge_to_set [LAMBDA O (INT X Y)] [X COLLECTION] [Y COLLECTION]){{< /fatecode >}}
-{{< fatecode >}}(indexed_merge_to_set [LAMBDA O (INT X Y Z0 ... ZN)] [X COLLECTION] [Y COLLECTION] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
-Merges two collections into either a list or a set, indicating the index of both
-elements as first parameter for the lambda function. This version of merging
-only continues as long as both collections have elements. Thus, extra elements
-in either list are ignored and there is only one index passed as parameter for
-the lambda function. Extra parameters for the lambda function can be
-passed as extra parameters of the call. Note that the variable shorthand cannot
-be used for those extra parameters.
+{{< fatecode >}}(list:indexed_merge [LAMBDA O (INT X Y)] [X LIST|X SET] [Y LIST|Y SET]){{< /fatecode >}}
+{{< fatecode >}}(set:indexed_merge [LAMBDA O (INT X Y)] [X LIST|X SET] [Y LIST|Y SET]){{< /fatecode >}}
+Merges two collections into either a list (`list:merge`) or a set
+(`set:merge`). This version of merging only continues as long as both
+collections have elements. Thus, extra elements in either list are ignored.
+The first parameter passed to the lambda function is the index of the element
+in both collections.
### SAFE-MERGE COLLECTIONS (INDEXED)
-{{< fatecode >}}(safe_indexed_merge_to_list [LAMBDA O (INT X INT Y)] [X COMPUTATION*] [X COLLECTION] [Y COMPUTATION*] [Y COLLECTION]){{< /fatecode >}}
-{{< fatecode >}}(safe_indexed_merge_to_list [LAMBDA O (INT X INT Y Z0 ... ZN)] [X COMPUTATION*] [X COLLECTION] [Y COMPUTATION*] [Y COLLECTION] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
-{{< fatecode >}}(safe_indexed_merge_to_set [LAMBDA O (INT X INT Y)] [X COMPUTATION*] [X COLLECTION] [Y COMPUTATION*] [Y COLLECTION]){{< /fatecode >}}
-{{< fatecode >}}(safe_indexed_merge_to_set [LAMBDA O (INT X INT Y Z0 ... ZN)] [X COMPUTATION*] [X COLLECTION] [Y COMPUTATION*] [Y COLLECTION] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
-Merges two collections into either a list or a set. This version of merging
-continues as long as either collection has elements. Hence the extra two
-parameters compared to the non-safe version: these correspond to the value used
-for the lambda when a collection has ran out of elements but the other has not.
-This is also the reason why two indices are given. The index given for a list
-that has ran out of elements is equal the size of the list.
-Extra parameters for the lambda function can be passed as extra parameters of
-the call. Note that the variable shorthand cannot be used for those extra
-parameters.
+{{< fatecode >}}(list:indexed_safe_merge [LAMBDA O (INT X INT Y)] [X LIST|X SET] [X COMPUTATION] [Y LIST|Y SET] [Y COMPUTATION]){{< /fatecode >}}
+{{< fatecode >}}(set:indexed_safe_merge [LAMBDA O (INT X INT Y)] [X LIST|X SET] [X COMPUTATION] [Y LIST|Y SET] [Y COMPUTATION]){{< /fatecode >}}
+Safely merges two collections into either a list (`list:safe_merge`) or a set
+(`set:safe_merge`). This version of merging continues as long as either
+collection has elements. If one of the two collections runs out of elements
+before the other, it uses the provided default value (`[X COMPUTATION]` for the
+first list, `[Y COMPUTATION]` for the second one). The first and third parameters
+passed to the lambda function correspond to the index of the element in either
+collection. It does not increase if the collection has no more elements and is
+using the default value.
diff --git a/content/fate_v1/computations/conditionals/_index.md b/content/fate_v1/computations/conditionals/_index.md
index 7b65294..ee86b80 100644
--- a/content/fate_v1/computations/conditionals/_index.md
+++ b/content/fate_v1/computations/conditionals/_index.md
@@ -10,13 +10,22 @@ some condition. All possible returned values must be of the same type.
Returns `C0` is `[BOOL]` yields true, `C1` otherwise.
### COND
-{{< fatecode >}}(cond ([B0 = BOOL] [C0 = COMPUTATION]) ... ([BN = BOOL] [CN = COMPUTATION])){{< /fatecode >}}
+{{< fatecode >}}(cond
+ ([B0 = BOOL] [C0 = COMPUTATION])
+ ...
+ ([BN = BOOL] [CN = COMPUTATION])
+){{< /fatecode >}}
Returns `[CI]`, such that `[BI]` is the first to hold true. If there is not such
`Bi`, returns `[CN]`.
### SWITCH
-{{< fatecode >}}(switch [T = COMPUTATION] ([V0 = COMPUTATION] [C0 = COMPUTATION]) ... ([VN = BOOL] [CN = COMPUTATION]) [D = COMPUTATION]){{< /fatecode >}}a
+{{< fatecode >}}(switch [T = COMPUTATION]
+ ([V0 = COMPUTATION] [C0 = COMPUTATION])
+ ...
+ ([VN = BOOL] [CN = COMPUTATION])
+ [D = COMPUTATION]
+){{< /fatecode >}}a
Returns the first `CI` such that `VI` is equal to `T`. If there is not such
`VI`, returns `[D]`.
diff --git a/content/fate_v1/computations/lambda_functions/_index.md b/content/fate_v1/computations/lambda_functions/_index.md
index 35485a3..7992b54 100644
--- a/content/fate_v1/computations/lambda_functions/_index.md
+++ b/content/fate_v1/computations/lambda_functions/_index.md
@@ -7,17 +7,26 @@ corresponds to the function itself, the `eval` computation must be used to
obtain the value that the function computes.
### DEFINITION
-{{< fatecode >}}(lambda (([T0 = TYPE] {S0 = String}) ... ([TN = TYPE] {SN = String})) [COMPUTATION]){{< /fatecode >}}
+{{< fatecode >}}(lambda
+ (([T0 = TYPE] {S0 = String}) ... ([TN = TYPE] {SN = String}))
+ [COMPUTATION]
+){{< /fatecode >}}
Returns a lambda function taking `S0` ... `SN` of types `T0` ... `TN` as
arguments and evaluating to `[COMPUTATION]`.
### EVALUATION
-{{< fatecode >}}(eval [REFERENCE] [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}}
+{{< fatecode >}}(eval [LAMBDA O (C0 ... CN)] [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}}
Returns the result of evaluating the lambda function at `[REFERENCE]` given the
parameters `C0` ... `CN`.
+### PARTIAL EVALUATION
+{{< fatecode >}}(partial [LAMBDA O (C0 ... CN)] [C0 = COMPUTATION] ... [CM = COMPUTATION]){{< /fatecode >}}
+
+Returns a lambda function corresponding to the `[LAMBDA O (C0 ... CN)]` in which
+the first M parameters have already been filled with `C0` ... `CM`.
+
## Examples
{{< fatecode >}}(lambda ( (int i) )
(+ (var i) 1)
diff --git a/content/fate_v1/computations/text/_index.md b/content/fate_v1/computations/text/_index.md
index b91a75f..4f6f520 100644
--- a/content/fate_v1/computations/text/_index.md
+++ b/content/fate_v1/computations/text/_index.md
@@ -9,3 +9,8 @@ title: Text
### NEW LINE
{{< fatecode >}}(newline){{< /fatecode >}}
+
+### JOIN
+{{< fatecode >}}(join_text [TEXT LIST|TEXT SET] [TEXT]){{< /fatecode >}}
+Returns a text value corresponding to all elements of the text collection being
+appended, with `[TEXT]` having been put in between each pair.
diff --git a/content/fate_v1/extensions/_index.md b/content/fate_v1/extensions/_index.md
new file mode 100644
index 0000000..e9a04ee
--- /dev/null
+++ b/content/fate_v1/extensions/_index.md
@@ -0,0 +1,15 @@
+---
+title: Extensions
+weight: 9
+---
+
+{{< fatecode >}}(declare_extra_instruction {Identifier} [T0 = TYPE] ... [TN = TYPE]){{< /fatecode >}}
+Declares an external instruction `{Identifier}` with parameters of type `[T0]`
+... `[TN]`.
+
+{{< fatecode >}}(declare_extra_computation [R = TYPE] {Identifier} [T0 = TYPE] ... [TN = TYPE]){{< /fatecode >}}
+Declares an external computation `{Identifier}` with parameters of type `[T0]`
+... `[TN]` and returning a value of type `[R]`.
+
+{{< fatecode >}}(declare_extra_type {Identifier}){{< /fatecode >}}
+Declares an external type.
diff --git a/content/fate_v1/instructions/_index.md b/content/fate_v1/instructions/_index.md
index 70e3987..1f28036 100644
--- a/content/fate_v1/instructions/_index.md
+++ b/content/fate_v1/instructions/_index.md
@@ -23,7 +23,7 @@ Completes the execution of the current sequence.
Completes the execution of the script.
### SET VALUE
-{{< fatecode >}}(set! [REFERENCE] [COMPUTATION]){{< /fatecode >}}
+{{< fatecode >}}(set! [X REFERENCE] [X COMPUTATION]){{< /fatecode >}}
Gives the value `[COMPUTATION]` to `[REFERENCE]`.
@@ -39,7 +39,6 @@ once the visited sequence has completed.
### JUMP TO SEQUENCE
{{< fatecode >}}(jump_to! {String} [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}}
-
{{< fatecode >}}(jump_to! [SEQUENCE] [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}}
Jumps to the sequence named `{String}` (or stored in `[SEQUENCE]`), with `C0`
@@ -48,6 +47,6 @@ defined. Jumping to a sequence means that the execution of the current sequence
is replaced by that of the target sequence.
### INSTRUCTION LIST
-{{< fatecode >}}( [C0 = INSTRUCTION] ... [CN = INSTRUCTION]){{< /fatecode >}}
+{{< fatecode >}}([C0 = INSTRUCTION] ... [CN = INSTRUCTION]){{< /fatecode >}}
Instruction corresponding to the execution of `[C0]` ... `[CN]` in order.
diff --git a/content/fate_v1/instructions/addresses/_index.md b/content/fate_v1/instructions/addresses/_index.md
index 1b9cdc1..cf5143b 100644
--- a/content/fate_v1/instructions/addresses/_index.md
+++ b/content/fate_v1/instructions/addresses/_index.md
@@ -1,6 +1,12 @@
---
title: Addresses
---
+### ALLOCATION
+{{< fatecode >}}(allocate! [POINTER REFERENCE]){{< /fatecode >}}
+
+Set `[POINTER REFERENCE]` to the address of a new memory location of type
+`[TYPE]`. Don't forget to call `free` on it once you're done.
+
### DE-ALLOCATION
{{< fatecode >}}(free! [POINTER]){{< /fatecode >}}
diff --git a/content/fate_v1/instructions/collections/_index.md b/content/fate_v1/instructions/collections/_index.md
index fb557c2..0922b3e 100644
--- a/content/fate_v1/instructions/collections/_index.md
+++ b/content/fate_v1/instructions/collections/_index.md
@@ -6,85 +6,133 @@ lists; and `[SET]`, which are ordered lists, but only useable with
`[COMPARABLE]` elements.
### ADDING A MEMBER
-{{< fatecode >}}(add_element! [C0 = COMPUTATION*] ... [CN = COMPUTATION*] [COLLECTION VAR]){{< /fatecode >}}
+{{< fatecode >}}(list:add_element! [C0 = X COMPUTATION*] ... [CN = X COMPUTATION*] [X LIST REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:add_element! [C0 = X COMPUTATION*] ... [CN = X COMPUTATION*] [X SET REFERENCE]){{< /fatecode >}}
-Adds `C0` ... `CN` to `[COLLECTION VAR]`. If `[COLLECTION VAR]` is a `[LIST]`,
-the new members are added at the end of the list, in order (meaning that the
-list then ends with `CN`). Note that `[COMPUTATION*]` does not support use of
-the variable shorthand.
+Adds `C0` ... `CN` to the `[X LIST]` or `[X SET]` collection reference. If the
+collection is a `[LIST]`, the new members are added at the end of the list, in
+order (meaning that the list then ends with `CN`). Note that `[COMPUTATION*]`
+does not support use of the variable shorthand if this is a collection of
+strings or text.
### ADDING A MEMBER AT INDEX
-{{< fatecode >}}(add_element_at! [INT] [COMPUTATION*] [LIST VAR]){{< /fatecode >}}
+{{< fatecode >}}(list:add_element_at! [INT] [X COMPUTATION*] [X LIST REFERENCE]){{< /fatecode >}}
-Adds `[COMPUTATION*]` to `[LIST VAR]` at index `[INT]`. If `[INT]` is less than
-0, the element is added at the start of the list, and if `[INT]` is greater or
-equal to the size of the list, the element is added at the end of the list. Note
-that `[COMPUTATION*]` does not support use of the variable shorthand.
+Adds `[COMPUTATION*]` to `[X LIST REFERENCE]` at index `[INT]`. If `[INT]` is
+less than 0, the element is added at the start of the list, and if `[INT]` is
+greater or equal to the size of the list, the element is added at the end of
+the list. Note that `[COMPUTATION*]` does not support use of the variable
+shorthand if this is a collection of string or text.
### ADDING MEMBERS
-{{< fatecode >}}(add_all_elements! [COLLECTION] [COLLECTION VAR]){{< /fatecode >}}
+{{< fatecode >}}(list:add_all_elements! [X COLLECTION] [X LIST REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:add_all_elements! [X COLLECTION] [X SET REFERENCE]){{< /fatecode >}}
-Adds all the elements of `[COLLECTION]` to `[COLLECTION VAR]`. If
-`[COLLECTION VAR]` is a `[LIST]`, the new members are added at the end of the
-list.
+Adds all the elements of `[COLLECTION]` to the `[X LIST]` or `[X SET]`
+collection reference. In the case of `[X LIST]`, the new members are added at
+the end of the list.
### EMPTYING COLLECTIONS
-{{< fatecode >}}(clear! [COLLECTION]){{< /fatecode >}}
+{{< fatecode >}}(list:clear! [LIST REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:clear! [SET REFERENCE]){{< /fatecode >}}
-Removes all members of `[COLLECTION]`.
+Removes all members of the `[LIST]` or `[SET]` collection reference.
### REMOVING MEMBER
-{{< fatecode >}}(remove! [COMPUTATION] [COLLECTION]){{< /fatecode >}}
+{{< fatecode >}}(list:remove! [X COMPUTATION*] [X LIST REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:remove! [X COMPUTATION*] [X SET REFERENCE]){{< /fatecode >}}
-Removes the first member of `[COLLECTION]` equal to `[COMPUTATION]`.
+Removes the first member of the `[X LIST]` or `[X SET]` collection reference
+equal to `[COMPUTATION]`. Note that `[COMPUTATION*]` does not support use of
+the variable shorthand if this is a collection of string or text.
### REMOVING MEMBERS
-{{< fatecode >}}(remove_all! [COMPUTATION] [COLLECTION]){{< /fatecode >}}
+{{< fatecode >}}(list:remove_all! [X COMPUTATION*] [X LIST REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:remove_all! [X COMPUTATION*] [X SET REFERENCE]){{< /fatecode >}}
-Removes all instances of `[COMPUTATION]` from `[COLLECTION]`.
+Removes all values equal to `[COMPUTATION]` from the `[X LIST]` or `[X SET]`
+collection reference. Note that `[COMPUTATION*]` does not support use of the
+variable shorthand if this is a collection of string or text.
### REMOVING AT INDEX
-{{< fatecode >}}(remove_at! [INT] [COLLECTION]){{< /fatecode >}}
+{{< fatecode >}}(list:remove_at! [INT] [LIST REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:remove_at! [INT] [SET REFERENCE]){{< /fatecode >}}
-Removes the element of `[COLLECTION]` at `[INT]`.
+Removes from the collection reference the element at index `[INT]`.
### REVERSING LISTS
-{{< fatecode >}}(reverse! [LIST]){{< /fatecode >}}
+{{< fatecode >}}(list:reverse! [LIST REFERENCE]){{< /fatecode >}}
-Reverses the order of the members of `[LIST]`.
+Reverses the order of the members of `[LIST REFERENCE]`.
### FILTER ELEMENTS
-{{< fatecode >}}(filter! [LAMBDA BOOL (X)] [X COLLECTION VAR]){{< /fatecode >}}
-{{< fatecode >}}(filter! [LAMBDA BOOL (X Y0 ... YN)] [X COLLECTION VAR] [Y0 COMPUTATION*] ... [YN COMPUTATION*]){{< /fatecode >}}
-Modifies `[X COLLECTION VAR]` so that only the elements for which
-`[LAMBDA BOOL (X)]` returns `true` remain. If the lambda function needs extra
-parameters, use the second syntax, which adds those parameters at the end of the
-`(filter! ...)` call. Note that the variable shorthand cannot be used for these
-extra parameters.
+{{< fatecode >}}(list:filter! [LAMBDA BOOL (X)] [X LIST REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:filter! [LAMBDA BOOL (X)] [X SET REFERENCE]){{< /fatecode >}}
+Modifies the collection reference so that only the elements for which
+`[LAMBDA BOOL (X)]` returns `true` remain.
### FILTER ELEMENTS (INDEXED)
-{{< fatecode >}}(indexed_filter! [LAMBDA BOOL (INT X)] [X COLLECTION VAR]){{< /fatecode >}}
-{{< fatecode >}}(indexed_filter! [LAMBDA BOOL (INT X Y0 ... YN)] [X COLLECTION VAR] [Y0 COMPUTATION*] ... [YN COMPUTATION*]){{< /fatecode >}}
-Modifies `[X COLLECTION VAR]` so that only the elements for which
-`[LAMBDA BOOL (INT X)]` (with the `INT` being the element's index) returns
-`true` remain. If the lambda function needs extra parameters, use the second
-syntax, which adds those parameters at the end of the `(indexed_filter! ...)`
-call. Note that the variable shorthand cannot be used for these extra
-parameters.
-
-### MERGE COLLECTIONS
-{{< fatecode >}}(merge! [LAMBDA Y (X Y)] [X COLLECTION] [Y COLLECTION VAR]){{< /fatecode >}}
-{{< fatecode >}}(merge! [LAMBDA Y (X Y Z0 ... ZN)] [X COLLECTION] [Y COLLECTION VAR] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
-
-
-### SAFE-MERGE COLLECTIONS
-{{< fatecode >}}(safe_merge! [LAMBDA Y (X Y)] [X COMPUTATION*] [X COLLECTION] [Y COMPUTATION*] [Y COLLECTION VAR]){{< /fatecode >}}
-{{< fatecode >}}(safe_merge! [LAMBDA Y (X Y Z0 ... ZN)] [X COLLECTION] [X COMPUTATION*] [Y COMPUTATION*] [Y COLLECTION VAR] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
-
-### MERGE COLLECTIONS (INDEXED)
-{{< fatecode >}}(indexed_merge! [LAMBDA Y (INT X Y)] [X COLLECTION] [Y COLLECTION VAR]){{< /fatecode >}}
-{{< fatecode >}}(indexed_merge! [LAMBDA Y (INT X Y Z0 ... ZN)] [X COLLECTION] [Y COLLECTION VAR] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
-
-### SAFE-MERGE COLLECTIONS (INDEXED)
-{{< fatecode >}}(safe_indexed_merge! [LAMBDA Y (INT X INT Y)] [X COMPUTATION*] [X COLLECTION] [Y COMPUTATION*] [Y COLLECTION VAR]){{< /fatecode >}}
-{{< fatecode >}}(safe_indexed_merge! [LAMBDA Y (INT X INT Y Z0 ... ZN)] [X COMPUTATION*] [X COLLECTION] [Y COMPUTATION*] [Y COLLECTION VAR] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}}
+{{< fatecode >}}(list:indexed_filter! [LAMBDA BOOL (INT X)] [X LIST REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:indexed_filter! [LAMBDA BOOL (INT X)] [X SET REFERENCE]){{< /fatecode >}}
+Modifies the collection reference so that only the elements for which
+`[LAMBDA BOOL (INT X)]` returns `true` remain, with the `[INT]` value being the
+index of the element in the collection.
+
+### SUBLIST
+{{< fatecode >}}(list:sublist! [start_at = INT] [end_before = INT] [LIST REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:sublist! [start_at = INT] [end_before = INT] [SET REFERENCE]){{< /fatecode >}}
+
+Only keep in the collection reference the elements with indexes equal or
+greater than `[start_at]` and strictly lower than `[end_before]`.
+
+### SORT
+{{< fatecode >}}(list:sort! [LAMBDA INT (X X)] [X LIST REFERENCE]){{< /fatecode >}}
+
+Reorders the elements of the list reference according to the `[LAMBDA]`
+function. The resulting order is ascending. To compare two elements, the lambda
+function should return:
+- a negative number if the first argument is lower than the second.
+- zero if the first argument is equal to the second.
+- a non-null positive number otherwise.
+
+### SHUFFLE
+{{< fatecode >}}(list:shuffle! [LIST REFERENCE]+){{< /fatecode >}}
+
+Randomly changes the order of the elements in `[LIST REFERENCE]`. As a
+shorthand, multiple calls to the `list:shuffle!` instruction can be merged by
+passing more lists as arguments.
+
+### PUSH ELEMENT
+{{< fatecode >}}(list:push_right! [X COMPUTATION] [X LIST REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(list:push_left! [X COMPUTATION] [X LIST REFERENCE]){{< /fatecode >}}
+
+Adds an element `[X]` at the start (`list:push_left`) or the end
+(`list:push_right`) of a list reference.
+
+### POP ELEMENT
+{{< fatecode >}}(list:pop_right! [X LIST REFERENCE] [X REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(list:pop_left! [X LIST REFERENCE] [X REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:pop_right! [X SET REFERENCE] [X REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:pop_left! [X SET REFERENCE] [X REFERENCE]){{< /fatecode >}}
+
+
+Removes and retrieves the element at the start (`pop_left`) or the end
+(`pop_right`) of a list. The removed element is stored in `[X REFERENCE]`.
+
+### PARTITION
+{{< fatecode >}}(list:partition! [LAMBDA BOOL (X)] [if_true = X LIST REFERENCE] [if_false = X LIST REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:partition! [LAMBDA BOOL (X)] [if_true = X SET REFERENCE] [if_false = X SET REFERENCE]){{< /fatecode >}}
+
+Partitions a collection reference `[if_true]`, leaving in the collection all elements
+for which the lambda function returns `(true)` and moving to the collection reference
+`[if_false]` all elements for which the lambda function returns `(false)`.
+
+### PARTITION (INDEXED)
+{{< fatecode >}}(list:partition! [LAMBDA BOOL (INT X)] [if_true = X LIST REFERENCE] [if_false = X LIST REFERENCE]){{< /fatecode >}}
+{{< fatecode >}}(set:partition! [LAMBDA BOOL (INT X)] [if_true = X SET REFERENCE] [if_false = X SET REFERENCE]){{< /fatecode >}}
+
+Partitions a collection reference `[if_true]`, leaving in the collection all elements
+for which the lambda function returns `(true)` and moving to the collection reference
+`[if_false]` all elements for which the lambda function returns `(false)`. The first
+argument given to the lambda function corresponds to the index of the element in
+the collection (prior to the partitioning).
diff --git a/content/fate_v1/instructions/conditionals/_index.md b/content/fate_v1/instructions/conditionals/_index.md
index 39a51b3..f99a1cf 100644
--- a/content/fate_v1/instructions/conditionals/_index.md
+++ b/content/fate_v1/instructions/conditionals/_index.md
@@ -6,22 +6,36 @@ computation. Every conditional branch defines its hierarchy level, from the
local variables' point of view.
### IF
-{{< fatecode >}}(if [BOOL] [INSTRUCTION]){{< /fatecode >}}
+{{< fatecode >}}(if [BOOL]
+ [INSTRUCTION]
+){{< /fatecode >}}
Executes `[INSTRUCTION]` if, and only if, `[BOOL]` yields true.
### IF-ELSE
-{{< fatecode >}}(if_else [BOOL] [IF_TRUE = INSTRUCTION] [IF_FALSE = INSTRUCTION]){{< /fatecode >}}
+{{< fatecode >}}(if_else [BOOL]
+ [IF_TRUE = INSTRUCTION]
+ [IF_FALSE = INSTRUCTION]
+){{< /fatecode >}}
Executes `[IF_TRUE]` if `[BOOL]` yields true, but `[IF_FALSE]` if it does not.
### COND
-{{< fatecode >}}(cond ([C0 = BOOL] [I0 = INSTRUCTION]) ... ([CN = BOOL] [IN = INSTRUCTION])){{< /fatecode >}}
+{{< fatecode >}}(cond
+ ([C0 = BOOL] [I0 = INSTRUCTION])
+ ...
+ ([CN = BOOL] [IN = INSTRUCTION])
+){{< /fatecode >}}
Executes `[II]`, such that `[CI]` is the first listed boolean to yield true.
### SWITCH
-{{< fatecode >}}(switch [T = COMPUTATION] ([C0 = COMPUTATION] [I0 = INSTRUCTION]) ... ([CN = COMPUTATION] [IN = INSTRUCTION]) [DEFAULT = INSTRUCTION]){{< /fatecode >}}
+{{< fatecode >}}(switch [T = COMPUTATION]
+ ([C0 = COMPUTATION] [I0 = INSTRUCTION])
+ ...
+ ([CN = COMPUTATION] [IN = INSTRUCTION])
+ [DEFAULT = INSTRUCTION]
+){{< /fatecode >}}
Executes `[II]`, such that `[CI]` is the first listed computation to be equal
to `[T]`. Executes `[DEFAULT]` if there is no such `[CI]`.
diff --git a/content/fate_v1/instructions/loops/_index.md b/content/fate_v1/instructions/loops/_index.md
index 5aa14ac..82acb28 100644
--- a/content/fate_v1/instructions/loops/_index.md
+++ b/content/fate_v1/instructions/loops/_index.md
@@ -6,24 +6,44 @@ Every loop body defines its hierarchy level, from the local variables' point of
view.
### WHILE
-{{< fatecode >}}(while [BOOL] [I0 = INSTRUCTION] ... [IM = INSTRUCTION]){{< /fatecode >}}
+{{< fatecode >}}(while [BOOL]
+ [I0 = INSTRUCTION]
+ ...
+ [IM = INSTRUCTION]
+){{< /fatecode >}}
Executes `[I0]` ... `[IM]` if, and as long as, `[BOOL]` yields true.
### DO WHILE
-{{< fatecode >}}(do_while [BOOL] [I0 = INSTRUCTION] ... [IM = INSTRUCTION]){{< /fatecode >}}
+{{< fatecode >}}(do_while [BOOL]
+ [I0 = INSTRUCTION]
+ ...
+ [IM = INSTRUCTION]
+){{< /fatecode >}}
Executes `[I0]` ... `[IM]`, and does so again as long as, `[BOOL]` yields
true.
### FOR
-{{< fatecode >}}(for [PRE = INSTRUCTION] [BOOL] [POST = INSTRUCTION] [I0 = INSTRUCTION] ... [IM = INSTRUCTION]){{< /fatecode >}}
+{{< fatecode >}}(for
+ [PRE = INSTRUCTION]
+ [BOOL]
+ [POST = INSTRUCTION]
+
+ [I0 = INSTRUCTION]
+ ...
+ [IM = INSTRUCTION]
+){{< /fatecode >}}
Executes `[PRE]`, then, if and as long as `[BOOL]` yields true, executes
`[I0]` ... `[IM]` followed by `[POST]`.
### FOR EACH
-{{< fatecode >}}(foreach [COLLECTION] {String} [I0 = INSTRUCTION] ... [IM = INSTRUCTION]){{< /fatecode >}}
+{{< fatecode >}}(foreach [COLLECTION] {String}
+ [I0 = INSTRUCTION]
+ ...
+ [IM = INSTRUCTION]
+){{< /fatecode >}}
Executes `[I0]` ... `[IM]` for each member of `[COLLECTION]`, in order. The current
member is stored in a new local variable named `{String}`.
diff --git a/content/fate_v1/instructions/player_choices/_index.md b/content/fate_v1/instructions/player_choices/_index.md
index 9ead97c..4b54789 100644
--- a/content/fate_v1/instructions/player_choices/_index.md
+++ b/content/fate_v1/instructions/player_choices/_index.md
@@ -6,17 +6,29 @@ with a list of `[TEXT]` choices, and executing a list of instructions
associated to the choice they have made.
### CHOICE OPTION
-{{< fatecode >}}(option [TEXT] [I0 = INSTRUCTION] ... [IN = INSTRUCTION]){{< /fatecode >}}
+{{< fatecode >}}(option [TEXT]
+ [I0 = INSTRUCTION]
+ ...
+ [IN = INSTRUCTION]
+){{< /fatecode >}}
Adds a choice showing `[TEXT]` to the user, and executing `[I0]` ... `[IN]`
if chosen.
### CHOICE PROMPT
-{{< fatecode >}}(player_choice! [C0 = CHOICE] ... [C1 = CHOICE]){{< /fatecode >}}
+{{< fatecode >}}(player_choice!
+ [C0 = CHOICE]
+ ...
+ [C1 = CHOICE]
+){{< /fatecode >}}
Prompts the user to choose between `C0` ... `C1`. `[CHOICE]`. `[CHOICE]` is
either an option as shown above, a [conditional](../conditionals), or a
`for_each` (see [loops](../loops)) with `[CHOICE]` instead of `[INSTRUCTION]`.
+A special version of the `for` loop is also possible, as described below:
+
+### USER CHOICE - FOR
+TODO
### INTEGER PROMPT
{{< fatecode >}}(prompt_integer! [INT REFERENCE] [MIN = INT] [MAX = INT] [TEXT]){{< /fatecode >}}
diff --git a/content/fate_v1/notations/_index.md b/content/fate_v1/notations/_index.md
index a29a58b..eea96e2 100644
--- a/content/fate_v1/notations/_index.md
+++ b/content/fate_v1/notations/_index.md
@@ -15,18 +15,18 @@ Valid separators are spaces, tabs, and line returns. Having multiple separators
between two elements is the same as having a single one.
### Comments
-Comments are line without anything but any number of separators before `;;`.
-Every that follows the `;;` on that line is considered to be a comment.
+Every that follows a `;;` on a line is considered to be a comment.
{{< fatecode >}};; You can comment here
(fate_version 1)
- ;; Separators before the ';;' are also okay.
-something ;; This is not a comment, since the line contains something else.
+something ;; This very sentence is also a comment.
;; Multi line
;; comments need a ';;' on
;; every line.
(end)
{{< /fatecode >}}
+To write the `;;` string literal in fate, the syntax is `(2;)`.
+
### Literals
A literal is a hard-coded string. Basically, writing `42` corresponds to a
literal of value `42`. A literal is any non-empty hard-coded string not
@@ -43,6 +43,7 @@ Now, the rules about separators and parentheses being absent in literals is a
bit problematic for strings. To remedy this:
* Writing `(lp)` counts as writing the literal `(`.
* Writing `(rp)` counts as writing the literal `)`.
+* Writing `(2;)` counts as writing the literal `;;`.
* Writing `(sp)` counts as writing the literal ` ` (space).
Thus, you cannot write:
@@ -53,10 +54,10 @@ But you can write:
And it will be a bunch of `{STRING}` literals.
### Identifier
-`{IDENTIFIER}`: Non-empty string literal without space characters, `.`, `)`,
-or `(`. Line returns and tabs are considered to be space characters. Strings
-that correspond to valid numbers (e.g. `42`) are likely to cause issues and
-should thus be avoided.
+`{IDENTIFIER}`: Non-empty string literal without space characters, `;`, `.`,
+`)`, or `(`. Line returns and tabs are considered to be space characters.
+Strings that correspond to valid numbers (e.g. `42`) are likely to cause issues
+and should thus be avoided.
Examples of valid identifiers:
* {{< fatecode >}}i{{< /fatecode >}}
@@ -65,7 +66,6 @@ Examples of valid identifiers:
* {{< fatecode >}}80x9!{{< /fatecode >}}
* {{< fatecode >}}pseudo::namespacing<$confusion>**a**{{< /fatecode >}}
-
### Value
`[INT]`: Computation (or literal) returning a value of type `INT`. Similarly,
`[STRING]` would indicate the same for a value of type `STRING`.
@@ -81,7 +81,8 @@ as the `[STRING]` literal `my_var`, and to get the value of a variable, you
would need to write something like `(var my_var)`. `[STRING]` automatically
implies `[STRING*]`.
-If need be, `(string {STRING})`
+If need be, `(string {STRING})` lets you specify that you want `{STRING}` to be
+a string without any ambiguity.
Examples of valid value:
* Values for `[INT]`: