https://en.wikipedia.org/wiki/Subtype_polymorphism
https://en.wikipedia.org/wiki/Template_%28computer_science%29
subtype polymorphism = inheritance or interface implementation
templates / generics = composition
Does anyone have anything to add to this?
]]>What is a good answer for this?
]]>A better answer would be something along the lines of, “OOP is nice because it gives us encapsulation and polymorphism. Encapsulation lets us do more than just keep all our jank in one place. It lets us bind methods and operations to specific entities. It also lets us control access to stuff. It gives us the notion of “this.” Polymorphism lets us make generalizations when we’re talking about types, which is nice, because that’s how the real world is. A sort method won’t have to know about the underlying structure of a collection, as long as it knows that what it’s given is a collection in the way that it needs it to be.”
]]>Use filter, then reduce. Then map more wool onto the sheep!
]]>This is not valid because you are giving the variable ‘a’ multiple definitions. In an imperative paradigm, this a would be given each definition sequentially, but in a functional paradigm, you’re just assigning multiple definitions, and the compiler/interpreter/machine has no good lead as to which definition should be used.
]]>Note: first class citizenship just means “treated like a variable”
]]>