From: Jérémie Astor Date: Mon, 18 Apr 2022 07:13:09 +0000 (+0200) Subject: :art: Add partial application X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=3b541c83167636f73b3cbeda0333705edac6810d;p=gwion.git :art: Add partial application --- diff --git a/docs/Reference/Functions/README.mdr b/docs/Reference/Functions/README.mdr index 0c8351e5..6c034028 100644 --- a/docs/Reference/Functions/README.mdr +++ b/docs/Reference/Functions/README.mdr @@ -40,3 +40,20 @@ fun void myfunc(int i, int j) { #! 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 + +```gwion,editable +fun int test(int i, int j) { + return i + j; +} + +curry(test, _, 2) @=> const auto mytest; + +<<< 40 => mytest >>>; +```