DEV Community

Discussion on: JavaScript Bites: Closure

Collapse
 
zaferberkun profile image
zaferberkun

Hi Brett,

I like that! Also, after some consideration, I think I was actually wrong and your original example (and the one by peerreynders below) is a perfectly valid example of partial application.

What threw me was the use of an "intermediary" make function to create the partial. What I was expecting was that the function itself, logger in this case, could be applied partially "in place". You would have to add "undefined" arg checks, but that way you could do full or partial application without "intermediary" maker functions for each arg permutation. Of course, if you're planning using composition, you'll need to generate a partial that only takes one arg (which your logger make example is doing). Anyway, sorry about that, you can disregard my original post if you want.

Btw, great writing, hope you'll tackle some more functional programming concepts! I'm going to have to backtrack and read the ones you've already written.