exercise 1.33 filtered-accumulate