scala exercises (P50 unfinished)