scala exercises (P57)