try to solve exercises for scala impatient book