simply scheme 第五章 练习

5.1 (1)(I me mine) (2)(is empty) (3) 1234 (4) (23 45) (5) "" (6) () (7) 6 (8) ("" "") (9) 2

 

5.2 

 

(define (f1 wd1 wd2)

  (sentence (bf wd1) (bf wd2)))

 

(define (f2 wd1 wd2)

  (sentence (bf wd1) (bl wd2) (word (first wd1) (last wd2))))

 

(define (f3 wd1 wd2)

  (se wd1 wd1))

 

(define (f4 wd1 wd2)

  (word (first (butfirst wd1)) (first (butfirst wd2))))

 

 

5.3 output: m and mezzanine

 

5.4 output: 4 and square

 

5.5 output: abc and (a b c)

 

5.6 输出一样

 

5.7 output: "" and ()

 

5.8 none

 

5.9 (matt wright) (brian harvey)

 

5.10 word returns word sentence returns sentence

 

5.11 the same as 5.10

 

5.12 

5.13 'banana quote

 

5.14 (define (third x)

  (first(butfirst(butfirst x))))

 

5.15 (define (first-two x)

  (word (first x)(first (butfirst x))))

 

5.16 (define (two-first x y)

  (word (first x)(first y)))

 

 (define (two-first-sent x)

  (word (first(first x))(first(first(butfirst x)))))

 

5.17 (define (knight x)

  (se 'Sir x))

 

5.18 error

 

5.19 (define (insert-and x)

  (se (butlast x) 'and (last x)))

 

5.20 (define (middle-names x)

  (butlast(butfirst x)))

 

5.21

 

(define (query x)

  (se (first (butfirst x)) (first x) (butfirst(butfirst x)) '?))

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值