sicp exercise 1.3 in ruby