Tuesday, May 16, 2023

129: Currying

 Currying is a process in functional programming that allows you to partially apply a function given some of the arguments. A curried function is called multiple times and accumulates arguments through each call. This can have various implementations such as improving code readability and allowing for multi-step API calls. Today's Leetcode challenge was to create a function that curries another function. This can be accomplished with a recursive solution. The code checks if the number of passed arguments is greater than or equal to the number of arguments for the function. If so, the function is called with all the arguments. If not, the recursive curry function is called again with new arguments accumulated on. 

No comments:

Post a Comment

190: Sablier

 The CodeHawks platform has an upcoming audit on the Sablier protocol, so I decided to read through the docs and familiarize myself with the...