From 072480c2ad567e3cf752afe4d756145ae2122532 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Wed, 20 Apr 2022 16:20:08 +0200 Subject: [PATCH] update --- docs/Reference/Functions/README.mdr | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/docs/Reference/Functions/README.mdr b/docs/Reference/Functions/README.mdr index 6c034028..d03acaa9 100644 --- a/docs/Reference/Functions/README.mdr +++ b/docs/Reference/Functions/README.mdr @@ -18,42 +18,18 @@ fun int test_function(int arg) { ``` -## 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, _); -``` - ## Partial Application According to wikipeda: *In computer science, partial application (or partial function application) refers to the process of fixing a number of arguments to a function, producing another function of smaller arity.* -In gwion, you can use the `curry` function to achieve that +In gwion, you can use a *hole* `_` to achieve that ```gwion,editable fun int test(int i, int j) { return i + j; } -curry(test, _, 2) @=> const auto mytest; - +test(_, 2) @=> const auto mytest; <<< 40 => mytest >>>; ``` -- 2.43.0