From 3b541c83167636f73b3cbeda0333705edac6810d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 18 Apr 2022 09:13:09 +0200 Subject: [PATCH] :art: Add partial application --- docs/Reference/Functions/README.mdr | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 >>>; +``` -- 2.43.0