# 《Two Dozen Short Lessons in Haskell》学习（十七） - Modules as Libraries

## 第17章 模块库

1 Software libraries

a contain functions encapsulated in modules

b provide a way to package reusable software

c both of the above

d none of the above

2 A module that supplies reusable software should

a export all of the functions it defines

b import all of the functions it defines

c export reusable functions, but prevent outside access to functions of limited use

d import reusable functions, but avoid exporting them

3 The formula concat ["The", "Gold", "Bug"] delivers

a "The Gold Bug"

b ["The", "Gold", "Bug"]

c "TheGoldBug"

d [["The], ["Gold"], ["Bug"]]

4 Encryption is a good example to study in a computer science course because

a it is an important use of computers

b it involves the concept of representing information in different ways

c both of the above

d well … really … it’s a pretty dumb thing to study

5 The DES cipher is a block cipher. A block cipher is

a a substitution cipher on a large alphabet

b a rotation cipher with scrambled internal cycles

c less secure than a substitution cipher

d more secure than a substitution cipher

6 Professor Dijkstra thinks that in the software development profession

a mathematical ability is the only really important asset that programmers need

b the ability to express oneself in a natural language is a great asset to programmers

c mathematical ability doesn’t have much influence on a programmer’s effectiveness

d it’s a waste of time to prove, mathematically, the correctness of program components

=========================================================

=========================================================

1 c

2 c

module ModuleName (function1, function2)

3 c

concat函数可以把一个列表中的元素连接在一起，定义如下：

concat :: [[a]] -> [a]

concat [[1,2,3], [4,5], [6,7,8,9]]  = [1, 2, 3, 4, 5, 6, 7, 8, 9]

concat的实际内部定义是这样的：

concat = foldr (++) [ ]

4 c

5 a

6 b

Besides a mathematical inclination, an exceptionally good mastery of one's native tongue is the most vital asset of a competent programmer.

posted @ 2013-03-15 06:56  申龙斌的程序人生  阅读(766)  评论(0编辑  收藏  举报