现在的位置: 首页 > 综合 > 正文

simply scheme 第十一章 练习

2013年12月06日 ⁄ 综合 ⁄ 共 728字 ⁄ 字号 评论关闭

<!--
@page { margin: 2cm }
PRE.western { font-family: "DejaVu Sans Mono", monospace }
PRE.cjk { font-family: "AR PL UKai CN", monospace }
PRE.ctl { font-family: "DejaVu Sans Mono", monospace }
P { margin-bottom: 0.21cm }
-->

11.1

(define (downup4 wd)

  (se wd

      (bl wd)

      (bl (bl wd))

      (first wd)

      (bl (bl wd))

      (bl wd)

      wd))

11.2

(define (count-ums sent)

  (if(empty? sent)

     0

     (if(equal? 'um (first sent))

     (+ 1(count-ums(bf sent)))

     (count-ums(bf sent)))))

11.3

(define (phone-unspell wd)

  (if(empty? wd)

     '()

     (accumulate word(se (unspell-letter(first wd))

         (phone-unspell (bf wd))))))

11.4

Marilu Henner

11.5

(define (initials sent)

  (if(empty? sent)

     '()

     (se (first(first sent)) (initials (bf sent)))))

11.6

(define (countdown num)

  (if(equal? num 0)

     'BLASTOFF

     (se num (countdown (- num 1)))))

11.7

(define (copies num wd)

  (if(equal? num 0)

     '()

     (se wd (copies (- num 1) wd))))

抱歉!评论已关闭.