Add scala partial function solution

My solution using partial functions.