Exercise 10.5
This procedure simply returns the sum of the squares of a and
b. Note that + is used as the name
for the procedure *, and * is used as the
name for the procedure +.
(define (countdown n) (if (= n 0) '(blastoff!) (se n (countdown (- n 1)))))
(define (copies n wd) (if (= n 0) '() (se wd (copies (- n 1) wd))))
(define (addup nums) (if (empty? nums) 0 (+ (first nums) (addup (bf nums)))))
(define (acronym sent) (if (= (count sent) 1) (first (first sent)) (word (first (first sent)) (acronym (bf sent)))))
(define (acronym sent) (if (= (count sent) 0) "" ; returnning the empty word (word (first (first sent)) (acronym (bf sent)))))
(define (f sent) (if (empty? sent) sent (se (f (bf sent)) (first sent))))
(define (remove wd sent) (cond ((empty? sent) '()) ((equal? wd (first sent)) (remove wd (bf sent))) (else (se (first sent) (remove wd (bf sent))))))
(define (count thing) (if (empty? thing) 0 (+ 1 (count (bf thing)))))
(define (describe-time secs) (cond ((> secs 86400) (se (quotient secs 86400) 'days (describe-time (remainder secs 86400)))) ((> secs 3600) (se (quotient secs 3600) 'hours (describe-time (remainder secs 3600)))) ((> secs 60) (se (quotient secs 60) 'mins (describe-time (remainder secs 60)))) (else (se secs 'seconds))))