simply scheme 第二章 練習

 

Exercises

Use the functions program for all these exercises.

2.1 In each line of the following table we’ve left out one piece of information. Fill inthe missing details.

 

 

function

 arg 1

 arg 2

 result

word

 now

 here

 nowhere

sentence

 now

 here

 (now here)

first

 blackbird

 none

 b

first

 (blackbird)

 none

 blackbird

+

 3

 4

 7

every

 first

 (thank you girl)

 (hank ou irl)

member?

 e

 aardvark

 #F

member?

 the

 (the days)

 #t

keep

 vowel?

 (i will)

 (i)

keep

 vowel?

 不會

 eieio*

last

 ()

 none

 not in domain

every

 last

 (honey pie) 

 (y e)

keep

 vowel?

 taxman

 aa

 

 

 

2.2 What is the domain of the vowel? function?

所有的字母

 

2.3 One of the functions you can use is called appearances. Experiment with it, and then describe fully its domain and range, and what it does. (Make sure to try lots of cases. Hint: Think about its name.)

定義域:單個字母、數字 值域:0,1

2.4 One of the functions you can use is called item. Experiment with it, and then describe fully its domain and range, and what it does.

定義域:正整數,字符串 值域:單個字符  結構返回字符串的第i個字符

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章