my scala exercise