diff options
author | Domen Kožar <domen@dev.si> | 2016-05-30T22·40+0100 |
---|---|---|
committer | Domen Kožar <domen@dev.si> | 2016-05-30T22·40+0100 |
commit | 5339ae4437549296836a16fcc52040762404b403 (patch) | |
tree | 19109c086cd4f5fd81e37891ed7fdfa73e7782c7 /doc/manual | |
parent | f7be7324b433b0ac6385d5981054030524c92c4e (diff) | |
parent | 6766041b84f5bad6e489087521c3bdaabd750f01 (diff) |
Merge pull request #576 from qknight/args_explanation
extended args@ explanation
Diffstat (limited to 'doc/manual')
-rw-r--r-- | doc/manual/expressions/language-constructs.xml | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/doc/manual/expressions/language-constructs.xml b/doc/manual/expressions/language-constructs.xml index 74809bb412d3..7535e64ea9a5 100644 --- a/doc/manual/expressions/language-constructs.xml +++ b/doc/manual/expressions/language-constructs.xml @@ -177,13 +177,19 @@ map (concat "foo") [ "bar" "bla" "abc" ]</programlisting> <listitem><para>An <literal>@</literal>-pattern provides a means of referring to the whole value being matched: -<programlisting> -args@{ x, y, z, ... }: z + y + x + args.a</programlisting> +<programlisting> args@{ x, y, z, ... }: z + y + x + args.a</programlisting> + +but can also be written as: + +<programlisting> { x, y, z, ... } @ args: z + y + x + args.a</programlisting> Here <varname>args</varname> is bound to the entire argument, which is further matched against the pattern <literal>{ x, y, z, - ... }</literal>.</para></listitem> - + ... }</literal>. <literal>@</literal>-pattern makes mainly sense with an + ellipsis(<literal>...</literal>) as you can access attribute names as + <literal>a</literal>, using <literal>args.a</literal>, which was given as an + additional attribute to the function. + </para></listitem> </itemizedlist> @@ -359,4 +365,4 @@ character, or inline/multi-line, enclosed within <literal>/* </simplesect> -</section> \ No newline at end of file +</section> |