3 ms·
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 "clas
by Roboprog 11y ago
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.
- thesagan 11y agoThank you for that analogy, I think you might have saved me a bit of time wrapping my head around the FP "paradigm".