From: Jérémie Astor Date: Sun, 17 Apr 2022 12:55:23 +0000 (+0200) Subject: Add to function docs X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=7f71118fa6dd49d1ae33c73b6034c9b9a219c016;p=gwion.git Add to function docs --- diff --git a/docs/Reference/Functions/README.mdr b/docs/Reference/Functions/README.mdr index 80fb62b9..0c8351e5 100644 --- a/docs/Reference/Functions/README.mdr +++ b/docs/Reference/Functions/README.mdr @@ -16,3 +16,27 @@ fun int test_function(int arg) { #! or use alternate syntax <<< 1 => test_function >>>; ``` + + +## Any Position Method syntax + +Due to the hybrid nature of function call syntax +and the left to right workflow in gwion, +some syntaxic sugar is provided +to call a function with arguments +from both the left and right side + +Arguments coming from the left are referenced as `_` +in the right hand side + +```gwion,editable +fun void myfunc(int i, int j) { + <<< "${i} ${j}" >>>; +} + +#! prints '1 2' +1 => myfunc(_, 2); + +#! prints '1 2' +2 => myfunc(1, _); +```