3 ms·
> You can think of a class as a higher order function, that takes in a list of arguments (constructor), and returns a list of functions, that are defined within
by brabel 6y ago
> You can think of a class as a higher order function, that takes in a list of arguments (constructor), and returns a list of functions, that are defined within the closure of those arguments
That's a really great definition of a class (when used as a "service" class, rather than a data class or an enum class, for example). And to me, shows that FP and OOP are really two sides of the same coin. Limit OOP to immutable data structures, and you get something extremely close to FP.