From 7272d83113545ec46b35ea440811dfc7da7634e1 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Tue, 22 Dec 2020 23:34:09 +0100 Subject: ... --- content/fate_v1/instructions/collections/_index.md | 21 +++++++++++---------- content/fate_v1/instructions/conditionals/_index.md | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'content/fate_v1/instructions') diff --git a/content/fate_v1/instructions/collections/_index.md b/content/fate_v1/instructions/collections/_index.md index 8d646ee..41de4f8 100644 --- a/content/fate_v1/instructions/collections/_index.md +++ b/content/fate_v1/instructions/collections/_index.md @@ -6,11 +6,12 @@ lists; and `[SET]`, which are ordered lists, but only useable with `[COMPARABLE]` elements. ### ADDING A MEMBER -{{< fatecode >}}(add_element! [COMPUTATION*] [COLLECTION VAR]){{< /fatecode >}} +{{< fatecode >}}(add_element! [C0 = COMPUTATION*] ... [CN = COMPUTATION*] [COLLECTION VAR]){{< /fatecode >}} -Adds `[COMPUTATION*]` to `[COLLECTION VAR]`. If `[COLLECTION VAR]` is a -`[LIST]`, the new member is added at the end of the list. Note that -`[COMPUTATION*]` does not support use of the variable shorthand. +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. ### ADDING A MEMBER AT INDEX {{< fatecode >}}(add_element_at! [INT] [COMPUTATION*] [LIST VAR]){{< /fatecode >}} @@ -53,19 +54,19 @@ Removes the element of `[COLLECTION]` at `[INT]`. Reverses the order of the members of `[LIST]`. ### FILTER ELEMENTS -{{< fatecode >}}(filter! [X COLLECTION VAR]){{< /fatecode >}} -{{< fatecode >}}(filter! [X COLLECTION VAR] [Y0 COMPUTATION*] ... [YN COMPUTATION*]){{< /fatecode >}} +{{< 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 -`` returns `true` remain. If the lambda function needs extra +`[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. ### FILTER ELEMENTS (INDEXED) -{{< fatecode >}}(indexed_filter! [X COLLECTION VAR]){{< /fatecode >}} -{{< fatecode >}}(indexed_filter! [X COLLECTION VAR] [Y0 COMPUTATION*] ... [YN COMPUTATION*]){{< /fatecode >}} +{{< 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 -`` (with the `INT` being the element's index) returns +`[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 diff --git a/content/fate_v1/instructions/conditionals/_index.md b/content/fate_v1/instructions/conditionals/_index.md index e129b1b..39a51b3 100644 --- a/content/fate_v1/instructions/conditionals/_index.md +++ b/content/fate_v1/instructions/conditionals/_index.md @@ -11,9 +11,9 @@ local variables' point of view. Executes `[INSTRUCTION]` if, and only if, `[BOOL]` yields true. ### IF-ELSE -{{< fatecode >}}(if_else [BOOL] ){{< /fatecode >}} +{{< fatecode >}}(if_else [BOOL] [IF_TRUE = INSTRUCTION] [IF_FALSE = INSTRUCTION]){{< /fatecode >}} -Executes `` if `[BOOL]` yields true, but `` if it does not. +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 >}} -- cgit v1.2.3-70-g09d2