My solution for SICP homework