Skip to content

Tag: currying

Boolean Currying Javascript

I am trying to write a boolean currying function in javascript. I want isPresent function should return true if the passed arguments present is the given string else it should return false. Answer A generic solution is to have the “accumulator” value passed in differently. The first call you do to…

Memoize a curried function

Is it possible to memoize f with regard to the 2 arguments, namely: Answer You could take a Map as cache and take nested maps for all following arguments. This cache works for arbitrary count of arguments and reuses the values from the former calls. It works by taking a curried function and an optional Map. I…