| summaryrefslogtreecommitdiff |
diff options
| -rw-r--r-- | content/fate_v1/computations/_index.md | 4 | ||||
| -rw-r--r-- | content/fate_v1/computations/collections/_index.md | 47 | ||||
| -rw-r--r-- | content/fate_v1/declarations/types/_index.md | 3 | ||||
| -rw-r--r-- | content/fate_v1/instructions/collections/_index.md | 17 |
4 files changed, 59 insertions, 12 deletions
diff --git a/content/fate_v1/computations/_index.md b/content/fate_v1/computations/_index.md index 71fe6f4..b9c4291 100644 --- a/content/fate_v1/computations/_index.md +++ b/content/fate_v1/computations/_index.md @@ -18,13 +18,13 @@ applicable. Structure members can be accessed by using `.` in `{String}`. ### STRUCTURE FIELD ACCESS {{< fatecode >}}{Structure Var Name}.{Field Name}{{< /fatecode >}} -{{< fatecode >}}(field [STRUCTURE VAR] {String}){{< /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 [STRUCTURE] {String}){{< /fatecode >}} +{{< fatecode >}}(get_field {String} [STRUCTURE]){{< /fatecode >}} Returns the value of the `{String}` field of the structure `[STRUCTURE]`. ### TEMPORARY VARIABLES diff --git a/content/fate_v1/computations/collections/_index.md b/content/fate_v1/computations/collections/_index.md index ec1c3e6..80a4ead 100644 --- a/content/fate_v1/computations/collections/_index.md +++ b/content/fate_v1/computations/collections/_index.md @@ -2,7 +2,7 @@ title: Collections --- ### ACCESS -{{< fatecode >}}(access [COLLECTION|COLLECTION PTR] [INT]){{< /fatecode >}} +{{< fatecode >}}(access [INT] [COLLECTION|COLLECTION PTR]){{< /fatecode >}} Returns the value of the `[INT]`th element in `[COLLECTION|COLLECTION PTR]`. @@ -13,7 +13,7 @@ Returns a variable corresponding to the `[INT]`th element in `[(COLLECTION|COLLECTION PTR) VAR]`. ### ACCESS POINTER -{{< fatecode >}}(access_pointer [(COLLECTION|COLLECTION PTR) VAR] [INT]){{< /fatecode >}} +{{< fatecode >}}(access_pointer [INT] [(COLLECTION|COLLECTION PTR) VAR]){{< /fatecode >}} Returns a pointer to the `[INT]`th element in `[(COLLECTION|COLLECTION PTR) VAR]`. @@ -88,7 +88,7 @@ that the variable shorthand cannot be used for these extra parameters. ### 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)] [X COMPUTATION*] [Y COLLECTION]){{< /fatecode >}} {{< fatecode >}}(foldr [LAMBDA X (X Y Z0 ... ZN)] [X COMPUTATION*] [Y COLLECTION] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}} Returns the result of iterating `[LAMBDA X (X Y)]` over `[Y COLLECTION]`, with @@ -103,21 +103,50 @@ those extra parameters, nor for the initial value. {{< 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. + ### SAFE-MERGE COLLECTIONS -{{< fatecode >}}(safe_merge_to_list [LAMBDA O (X Y)] [X COLLECTION] [X COMPUTATION*] [Y COLLECTION] [Y COMPUTATION*]){{< /fatecode >}} -{{< fatecode >}}(safe_merge_to_list [LAMBDA O (X Y Z0 ... ZN)] [X COLLECTION] [X COMPUTATION*] [Y COLLECTION] [Y COMPUTATION*] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}} +{{< 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. ### 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. ### SAFE-MERGE COLLECTIONS (INDEXED) -{{< fatecode >}}(safe_indexed_merge_to_list [LAMBDA O (INT X INT Y)] [X COLLECTION] [X COMPUTATION*] [Y COLLECTION] [Y COMPUTATION*]){{< /fatecode >}} -{{< fatecode >}}(safe_indexed_merge_to_list [LAMBDA O (INT X INT Y Z0 ... ZN)] [X COLLECTION] [X COMPUTATION*] [Y COLLECTION] [Y COMPUTATION*] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}} -{{< fatecode >}}(safe_indexed_merge_to_set [LAMBDA O (INT X INT Y)] [X COLLECTION] [X COMPUTATION*] [Y COLLECTION] [Y COMPUTATION*]){{< /fatecode >}} -{{< fatecode >}}(safe_indexed_merge_to_set [LAMBDA O (INT X INT Y Z0 ... ZN)] [X COLLECTION] [X COMPUTATION*] [Y COLLECTION] [Y COMPUTATION*] [Z0 COMPUTATION*] ... [ZN COMPUTATION*]){{< /fatecode >}} +{{< 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. diff --git a/content/fate_v1/declarations/types/_index.md b/content/fate_v1/declarations/types/_index.md index 52f8154..81f295b 100644 --- a/content/fate_v1/declarations/types/_index.md +++ b/content/fate_v1/declarations/types/_index.md @@ -11,7 +11,8 @@ There are a few base types already defined: * `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. + 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. diff --git a/content/fate_v1/instructions/collections/_index.md b/content/fate_v1/instructions/collections/_index.md index 41de4f8..5ecd3a0 100644 --- a/content/fate_v1/instructions/collections/_index.md +++ b/content/fate_v1/instructions/collections/_index.md @@ -71,3 +71,20 @@ Modifies `[X COLLECTION VAR]` so that only the elements for which 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 >}} |


