I have the following lambda function in haskell:
cup size = \message -> message size
I would like to know what is the equivalent version in JavaScript (for learning purpose), currently I wrote the following version, I would like to if it is correct.
const cup = size => (message => message)(size)
messagea method ? Because if yes i do not get the usage of lambda.You could writecup=messageand in jscup=str=>message(str)cupis notmessage;cupis a function that returns a function which applies its argument tocup's argument. One could also writecup size message = message size, which makes it more apparent thatcup = flip ($).