In functional programming, would you call such an operation?

In functional programming, would you call such an operation?

function(f,vargs){ //variable count of arguments
   return function(){
       return f(vargs)
   }
}

I think this is Currying, but I got the impression that currying is a term when we associate one argument with more than one argument. Or perhaps this is a delay, not entirely sure ...

+3
source share
5 answers

applyis the correct term — for example, Python had an equivalent apply(which is now deprecated).

See also a partial application in Haskell or in Javascript . If a partial application uses some arguments of a function, then it follows that the full application or just the application should use all the arguments, as you did above.

+4

, .

,

function(){
    return f(vargs)
}

, , f(vargs).

+4

, currying - , .

-

+2
+1
function(f, args) {
    return (
        function() { return f(vargs) }
      )
 }

f args, , , , f(args), f vargs .

In Mathematica, for example, you can write it as F[f_, args___] := f[args]&. Since the returned anonymous function is a constant function (takes no arguments), you can also write it as F[f_, args___] := f[args], omitting the latter &.

0
source

Source: https://habr.com/ru/post/1720168/


All Articles