exercise for SICP