Partial Functions

In this free Scala training video I demonstrate partial functions in Scala.

A partial function is a function that only works — only properly works — for a subset of its possible input values. I initially demonstrate this with a divide function that does not work when you try to divide numbers by zero.

Then I discuss the PartialFunction trait and its isDefinedAt method.