diff options
author | Leah Neukirchen <leah@vuxu.org> | 2022-10-31 19:03:39 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-10-31 19:03:39 +0100 |
commit | b3803374edb432b21cb98f03f1e22cd6f361a8bc (patch) | |
tree | c541180387edd7e963b08e6d0650c56936096b81 /mew.svnwiki | |
parent | 95a08bc1b290117c1c61c49b3c5c945d01120006 (diff) | |
download | mew-b3803374edb432b21cb98f03f1e22cd6f361a8bc.tar.gz mew-b3803374edb432b21cb98f03f1e22cd6f361a8bc.tar.xz mew-b3803374edb432b21cb98f03f1e22cd6f361a8bc.zip |
drop toplevel ->>, set->>, given; add if->
Diffstat (limited to 'mew.svnwiki')
-rw-r--r-- | mew.svnwiki | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/mew.svnwiki b/mew.svnwiki index 1f6a963..a9c7ee4 100644 --- a/mew.svnwiki +++ b/mew.svnwiki @@ -331,16 +331,18 @@ When the pattern {{<irx>}} uses match data, the result is unspecified. == Special syntax <syntax>(-> a -> b c -> d e f)</syntax> -<syntax>(->> a ->> b c ->> d e f)</syntax> +<syntax>(-> a ->> b c ->> d e f)</syntax> Nesting macros: {{->}} inserts the previous part as the second argument: {{(-> a -> b c -> d e f)}} expands to {{(d (b a c) e f)}}. {{->>}} inserts the previous part as the last argument: -{{(->> a ->> b c ->> d e f)}} expands to {{(d e f (b c a))}}. +{{(-> a ->> b c ->> d e f)}} expands to {{(d e f (b c a))}}. You can mix {{->}} and {{->>}} macros: -{{(->> a -> b c ->> d e f)}} expands to {{(d e f (b a c))}}. +{{(-> a -> b c ->> d e f)}} expands to {{(d e f (b a c))}}. + +Nesting macros must start off with a {{->}}. <syntax>(fun-> b c -> d e f)</syntax> <syntax>(fun->> b c ->> d e f)</syntax> @@ -348,15 +350,20 @@ You can mix {{->}} and {{->>}} macros: Nesting lambdas: like {{->}} but the nesting starts with the argument of the lambda. {{(fun-> b c -> d e f)}} expands to {{(lambda (x) (-> x -> b c -> d e f))}}. -{{(fun->> b c ->> d e f)}} expands to {{(lambda (x) (->> x ->> b c ->> d e f))}}. +{{(fun->> b c ->> d e f)}} expands to {{(lambda (x) (-> x ->> b c ->> d e f))}}. -<syntax>(set-> loc -> ...)</syntax> -<syntax>(set->> loc ->> ...)</syntax> +<syntax>(set-> loc ...)</syntax> Mutation with nesting macros: shortcut for {{(set loc (-> loc ...))}}. -<syntax>(given <val> <cond> <then> <else>?)<syntax> +<syntax>(-> ... if-> <val> <cond> <then> <else>?)<syntax> Evaluate {{<val>}}. Then, when {{<cond>}} is not false, behaves like {{(-> <val> -> <then>}}, otherwise like {{(-> <val> -> <else>)}} (or just {{<val>}} if no {{<else>}} was passed). + +<syntax>(-> ... and-> ...)<syntax> +<syntax>(-> ... and->> ...)<syntax> + +Like {{->}}/{{->>}} but skips nesting the code if the nested +expression is false. |