I’ve come to the firm belief that writing detailed functional specs upfront for software projects is a total waste of time. Software is meant oto be used and in order to find out what it’s use is going to be software architects need use cases. writing specs is just moronic when you have no idea on how it’s going to be used

## Ex 1.8 – Structure and Interpretation of Computer Programs

January 25, 2010; Ex 1.8

(define improve-cube-root

(lambda (x y)

(/ (+ (/ x (* y y)) (* 2 y))

3)))

(define cube-root-iter

(lambda (guess x )

(define next-guess ( / ( + (/ x (* guess guess)) (* 2 guess))

3))

(if (good-enough-2? next-guess guess)

next-guess

(cube-root-iter next-guess x))))

(define cube-root

(lambda (x)

(cube-root-iter 1.0 x)))

## Ex 1.7 – Structure and Interpretation of Computer Programs

January 25, 2010; Ex 1.7

(define (good-enough-2? guess prev-guess)

(< (abs (- guess prev-guess)) 0.0001))

(define sqrt-iter-2

(lambda (guess x)

(define next-guess (improve guess x))

(if (good-enough-2? next-guess guess)

next-guess

(sqrt-iter-2 next-guess x))))

## Ex 1.6 – Structure and Interpretation of Computer Programs

January 25, 2010; Ex 1.6

; The function will run forever, because Scheme is applicative order

; so the argument for the else clause will be evaluated causing the

; to routine to run forever.

## Ex 1.13 – Structure and Interpretation of Computer Programs

January 23, 2010Exercise 1.13 – SICP

We already know that

We also know that

So according to the finonacci definition (1)

Using wolfram alpha we can compute

If you plugin the values in the wolfram alpha , you can see that that both expansions at are also the same

**Edit** hmmm, looks like I missed the point of the problem. The real problem was to prove that Fib(n) approx= phi^n / 2 where phi = (1+sqrt(5))/2. I think I’ll have to redo this proof.

## Ex. 1.12 Structure and Interpretation of Computer Programs

January 23, 2010Generating Pascal’s Triangle. Not the most optimal implementation.

; Ex 1.12

(define bin-coeffs

(lambda (n k)

(cond ((= k 0 ) 1)

((= k n ) 1)

(else (+ (bin-coeffs (- n 1) (- k 1))

(bin-coeffs (- n 1) k))))))(define pascals-triangle-row

(lambda (n)

(define pascals-triangle-row-iter

(lambda (k coeff-list)

(cond ((> k n ) coeff-list)

(else (pascals-triangle-row-iter (+ k 1)

(cons (bin-coeffs n k) coeff-list))))))

(pascals-triangle-row-iter 0 ‘())))(define pascals-triangle

(lambda (d)

(define pascals-triangle&co

(lambda (i col)

(cond ((= i -1) col)

(else (pascals-triangle&co (- i 1)

(cons (pascals-triangle-row i) col

))))))

(pascals-triangle&co d ‘())))

## Flash and other virtual machines on the iPhone

January 19, 2010I think it’s pretty lame that apple does not allow any other runtimes other than it’s own. It means that if a site makes heavy use of flash or java or silverlight it’s functioanlity is off limits to an iPhone use surfing the web.

Having said that I hate flash and I can’t wait for the day when HTML css and JavaScript finally makes that proprietay framework obsolete.