Is there a name for this function

I am looking for a name for the following function:

(f, a) => () => f(a)

Basically a function that returns a function that, when called, calls fwith a.

Is there a common name for this function? maybe this can be described using ramda magic?


Edit to clarify:

What I'm looking for looks like a partial part of Ramda,

partial(f, [a])

Also, that partial is more like:

(f, a) => (b) => f(a, b)

Ie bin case partialundesirable.

+4
source share
6 answers

This is thunk .

, , . , ( , ..).

const enThunk = f => a => () => f(a); f(a), .

+8

.

. .

+2

, f (x, y), g (y) = f (5, y). x f 5.

+1

JavaScript bind. ( → f => a => f(a)).

:

const bind = (f, a) => () => f(a)
+1

.

- , .

:

(f, a) => () => f(a)

, .

-1

"arrow function" (() = >), JavaScript .

Depending on how this returned function is assembled and how any arguments are used for the first function (regardless of whether the arrow functions are used), "currying" may occur, although this is not done in your example.

-2
source

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


All Articles