The water pouring example from Functional Programming Principles in Scala