| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2020-12-23 02:09:33 +0100 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2020-12-23 02:09:33 +0100 | 
| commit | b5b30786abdb77dc0c1f9ed1be6d9c594b398b1a (patch) | |
| tree | 8fcf531cacc82dcb7f154465fedce7497a8dbe87 /content/fate_v1/computations | |
| parent | 7272d83113545ec46b35ea440811dfc7da7634e1 (diff) | |
Adding some info on merge & parentheses.
Diffstat (limited to 'content/fate_v1/computations')
| -rw-r--r-- | content/fate_v1/computations/_index.md | 4 | ||||
| -rw-r--r-- | content/fate_v1/computations/collections/_index.md | 47 | 
2 files changed, 40 insertions, 11 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. | 


