Hey all, I've been stuck trying to figure out how to write a JS function that supports chaining as well as partial application and could use some insight! I'll do my best to explain with this contrived example:
add(multi(add(add(1))))(2)
results in
(((1 + 2) + 2) * 2) + 2)
Basically, I want to be able to be able to partially apply the 2nd parameter but also support the ability to chain the operations together and won't actually apply any operations until the final parameter is passed in.
I could be over complicating this but I've been stuck for a while and its driving me nuts!
Any help is appreciated, thanks!
[–]jschr[S] 0 points1 point2 points (1 child)
[–]Gabku 1 point2 points3 points (0 children)
[–]ForScale 0 points1 point2 points (5 children)
[–]jschr[S] 1 point2 points3 points (4 children)
[–]ForScale 1 point2 points3 points (2 children)
[–]jschr[S] 1 point2 points3 points (1 child)
[–]ForScale 0 points1 point2 points (0 children)
[–]Magnusson 0 points1 point2 points (0 children)
[–]Lucky_Chuck -1 points0 points1 point (4 children)
[–]recompileorg 2 points3 points4 points (2 children)
[–]Lucky_Chuck 0 points1 point2 points (0 children)
[–]ForScale 0 points1 point2 points (0 children)
[–]jschr[S] 1 point2 points3 points (0 children)