exercise 2.39 reverse with fold-left and fold-right