Solution to SICP exercises