Difference-of-Squares: Updated to use functions

Updated to use functions. Its possible to turn these functions into one liners, but it wouldn't really add anything. It wouldn't add anything teachable, and would only make the example harder to understand.