Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The author should probably have mentioned in the Currying section that it's roughly analogous to what OOP people call dependency injection.

Rather than a "class" with one "do it" method, which also has a constructor to initialize configurations (or worse, a bunch of "setters"), just make the configuration (or other "dependency") values the leading parameters of a function. Then, partially evaluating the function to supply those values does the same thing that "dependency injection" does, only without the logorrhea of a class.



Thank you for that analogy, I think you might have saved me a bit of time wrapping my head around the FP "paradigm".




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: