| summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'content/fate_v1/computations/collections/_index.md')
| -rw-r--r-- | content/fate_v1/computations/collections/_index.md | 47 |
1 files changed, 38 insertions, 9 deletions
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. |


