Add scala partial function solution