From 8ce96becf0ad7b41a272c4b30c36b56c517a2206 Mon Sep 17 00:00:00 2001 From: Joachim Schiele Date: Tue, 7 Jul 2015 02:09:50 +0200 Subject: extended args@ explanation --- doc/manual/expressions/language-constructs.xml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'doc') 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" ] An @-pattern provides a means of referring to the whole value being matched: - -args@{ x, y, z, ... }: z + y + x + args.a + args@{ x, y, z, ... }: z + y + x + args.a + +but can also be written as: + + { x, y, z, ... } @ args: z + y + x + args.a Here args is bound to the entire argument, which is further matched against the pattern { x, y, z, - ... }. - + ... }. This @-pattern makes mainly sense with an + ellipsis(...) as you can now access attribute names as + a, using args.a, which was given as an + additional attribute to the function. + -- cgit 1.4.1 From 659a3e399b74d90e1db045fa738d9bc520e2c72c Mon Sep 17 00:00:00 2001 From: Joachim Schiele Date: Mon, 30 May 2016 23:58:13 +0200 Subject: Update language-constructs.xml --- doc/manual/expressions/language-constructs.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/manual/expressions/language-constructs.xml b/doc/manual/expressions/language-constructs.xml index e438e4b20a1c..5bea0206ad15 100644 --- a/doc/manual/expressions/language-constructs.xml +++ b/doc/manual/expressions/language-constructs.xml @@ -186,7 +186,7 @@ but can also be written as: Here args is bound to the entire argument, which is further matched against the pattern { x, y, z, ... }. This @-pattern makes mainly sense with an - ellipsis(...) as you can now access attribute names as + ellipsis(...) as you can access attribute names as a, using args.a, which was given as an additional attribute to the function. @@ -365,4 +365,4 @@ character, or inline/multi-line, enclosed within /* - \ No newline at end of file + -- cgit 1.4.1 From 6766041b84f5bad6e489087521c3bdaabd750f01 Mon Sep 17 00:00:00 2001 From: Joachim Schiele Date: Mon, 30 May 2016 23:58:45 +0200 Subject: Update language-constructs.xml --- doc/manual/expressions/language-constructs.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/manual/expressions/language-constructs.xml b/doc/manual/expressions/language-constructs.xml index 5bea0206ad15..7535e64ea9a5 100644 --- a/doc/manual/expressions/language-constructs.xml +++ b/doc/manual/expressions/language-constructs.xml @@ -185,7 +185,7 @@ but can also be written as: Here args is bound to the entire argument, which is further matched against the pattern { x, y, z, - ... }. This @-pattern makes mainly sense with an + ... }. @-pattern makes mainly sense with an ellipsis(...) as you can access attribute names as a, using args.a, which was given as an additional attribute to the function. -- cgit 1.4.1