The Secret Life of JavaScript: Currying vs. Partial Application
The Secret Life of JavaScript: Currying vs. Partial Application # javascript # coding # programming # softwaredevelopment Timothy was staring at his monitor with the distinct expression of someone whose brain had just finished buffering and decided to crash. On his screen was a single line of JavaScript he had pulled from a functional programming utility library. const formatUrl = protocol => domain => path => ` ${ protocol } :// ${ domain } / ${ path } ` ; "Margaret," Timothy said, without looking away from the screen. "My eyes are crossing. Why are there so many arrows? And why does calling it look like a nesting doll accident?" He pointed to how the function had to be used: formatUrl ( ' https ' )( ' somewebsite.com ' )( ' /blog/post-1 ' ); Margaret rolled her chair over, coffee mug in hand. She smiled. "Ah. You've discovered the 'scary syntax' part of functional programming. You're looking at Cu...