scala exercises (P62)