Exercise 6.1.1: (back)

> (distance-to-0 (make-posn 3 4))
5

=> (sqrt
    (+
     (sqr (posn-x (make-posn 3 4)))
     (sqr (posn-y (make-posn 3 4)))))

=> (sqrt
    (+
     (sqr (3))
     (sqr (4))))

=> (sqrt
    (+ (9) (16)))

=> (sqrt 25)

=> 5


> (distance-to-0 (make-posn (* 2 3) (* 2 4)))
10

=> (make-posn (* 2 3) (* 2 4))

=> (make-posn (6) (8))

=> (sqrt
    (+
     (sqr (posn-x (make-posn 6 8)))
     (sqr (posn-y (make-posn 6 8)))))
     
=> (sqrt
    (+
     (sqr (6))
     (sqr (8))))

=> (sqrt
    (+ (36) (64)))

=> (sqrt 100)

=> 10

    

> (distance-to-0 (make-posn 12 (- 6 1)))
13

=> (make-posn (12) (* 2 4))

=> (make-posn (12) (5))

=> (sqrt
    (+
     (sqr (posn-x (make-posn 12 5)))
     (sqr (posn-y (make-posn 12 5)))))
     
=> (sqrt
    (+
     (sqr (12))
     (sqr (5))))

=> (sqrt
    (+ (144) (25)))

=> (sqrt 169)

=> 13