diff options
author | Joachim Schiele <js@lastlog.de> | 2015-07-07T00·09+0200 |
---|---|---|
committer | Joachim Schiele <js@lastlog.de> | 2015-07-07T00·09+0200 |
commit | 8ce96becf0ad7b41a272c4b30c36b56c517a2206 (patch) | |
tree | de63525823a31076b036891ad82cd5e456895d84 | |
parent | dd48c06bb6b9accce92eb7e3806b9cd2af2482cf (diff) |
extended args@ explanation
-rw-r--r-- | doc/manual/expressions/language-constructs.xml | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/doc/manual/expressions/language-constructs.xml b/doc/manual/expressions/language-constructs.xml index 74809bb412d3..e438e4b20a1c 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>. This <literal>@</literal>-pattern makes mainly sense with an + ellipsis(<literal>...</literal>) as you can now 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> |