Complete solution of first exercise on lists