studying scala's functions