Support Mandy in the Weekend to End Breast Cancer

The Weekend to End Breast CancerIn September, Mandy will be walking in The Weekend to End Breast Cancer, a two-day, 60km walk to raise money for the Princess Margaret Hospital Foundation, Canada’s largest institution devoted to cancer research and treatment. She writes:

I will be walking for my stepmother, Linda, who is a survivor and I will be walking for and with my sister, Lauren, who I hope will never have to go through what her mother went through. Please help make this possible.

You can donate online through Mandy’s donation page.

Solution to SICP Exercise 1.5

Structure and Interpretation of Computer Programs

Solution to Exercise 1.5:

With applicative-order evaluation, the expression that Ben entered for evaluation will fail to terminate. The reason for this has to do with expression (p) evaluating to itself. When evaluating with applicative order, every combination within an expression is evaluated before the expression itself. The (p) combination never finishes evaluating because it keeps evaluating to itself.

With normal-order evaluation, the expression will be evaluated to 0. The reason is that the (p) combination is passed to test unevaluated. According to normal-order evaluation rules, it isn’t evaluated by the interpreter until its value is needed. The condition of the if expression in test is satisfied (because the expression (= 0 0) evaluates to #t, so the test procedure evaluates to 0. There is never any need to evaluate (p).

Solution to SICP Exercise 1.1

Structure and Interpretation of Computer Programs

This morning I began my third attempt at reading the programming classic Structure and Interpretation of Computer Programs, otherwise known as SICP. My earlier attempts stalled for various reasons, but this time I hope to get through the entire book. As an incentive to finish, I’m publicly promising to post my solutions to all the exercises in the book on this blog, starting with Exercise 1.1:
>10
10

>(+ 5 3 4)
12

>(- 9 1)
8

>(/ 6 2)
3

>(+ (* 2 4) (- 4 6))
6

>(define a 3)

>(define b (+ a 1))

>(+ a b (* a b))
19

>(= a b)
#f

>(if (and (> b a) ((cond ((= a 4) 6)
((= b 4) (+ 6 7 a))
(else 25))
16

>(+ 2 (if (> b a) b a))
6

>(* (cond ((> a b) a)
((< a b) b)
(else -1))
(+ a 1))
16

What Should I Do With My Life?

What Should I Do With My LifeMaybe its just the beer after having just given blood, but I found Po Bronson’s article, What Should I Do With My Life moving and inspiring, if not a little depressing. To quote:

Asking “What Should I Do With My Life?” is the modern, secular version of the great timeless questions about our identity. Asking The Question aspires to end the conflict between who you are and what you do. Answering The Question is the way to protect yourself from being lathed into someone you’re not. What is freedom for if not the chance to define for yourself who you are?

The article is based on a book by the same title, which, after reading the article, I feel deserves a place on my wishlist.