Scala: filtering operation. Didactic