completed small program to map a function over a vector and collect the results