Introduction to programming using SML [1 ed.] 0201398206, 9780201398205, 3143173203

Introduction to Programming using SML provides a thorough introduction to the principles of programming and program desi

263 29 5MB

English Pages 355 [372] Year 1999

Report DMCA / Copyright

DOWNLOAD DJVU FILE

Table of contents :
Cover
Title Page
Copyright Page
Dedication
Table of Contents
Preface
1 Getting started
1.1 Values, types, identifiers and declarations
1.2 Simple function declarations
1.3 Comments
1.4 Recursion
1.5 The power function
1.6 About types and type checking
1.7 Bindings and environments
1.8 Summary
Exercises
2 Basic values and operators
2.1 Integers and reals
2.2 Expressions, precedence, association
2.3 Euclids algorithm
2.4 Evaluations with environments
2.5 Characters and strings
2.6 Truth values
2.7 The if-then-else expression
2.8 Overloaded operators
2.9 Type inference
2.10 Summary
Exercises
3 Tuples and records
3.1 Tuples
3.2 Tuple patterns
3.3 Infix functions on pairs
3.4 Records
3.5 Record patterns
3.6 Type declarations
3.7 Locally declared identifiers
3.8 Summary
Exercises
4 Problem solving I
4.1 Problem statement: rational numbers
4.2 Solution 1
4.3 Solution 2
4.4 Comparing the solutions
4.5 A solution using records
4.6 Summary
Exercises
5 Lists
5.1 Building lists
5.2 The cons operator
5.3 List patterns
5.4 Append and reverse; polymorphic types
5.5 Polymorphic values
5.6 A library of list functions
5.7 Membership; equality types
5.8 Type inference
5.9 Summary
Exercises
6 Problem solving 11
6.1 Problem analysis: cash register
6.2 Programming
6.3 Test
6.4 Summary
Exercises
7 Tagged values and partial functions
7.1 Datatype declarations
7.2 The case-expression
7.3 Enumeration types
7.4 The order type
7.5 Partial functions: the option datatype
7.6 Exception handling
7.7 The Eight Queens problem
7.8 Summary
Exercises
8 Finite trees
8.1 Chinese boxes
8.2 Symbolic differentiation
8.3 Trees of ancestors; traversal of a tree
8.4 Mutual recursion
8.5 Parameterized datatypes
8.6 Electrical circuits
8.7 Abstract types
8.8 Summary
Exercises
9 Higher-order functions
9.1 Expressions denoting functions
9.2 Value declarations of recursive functions
9.3 The map function
9.4 Declaring higher order functions
9.5 Higher-order list functions
9.6 Functional composition
9.7 Tree recursion
9.8 Type inference for higher-order functions
9.9 Closures
9.10 Static binding
9.11 Lazy evaluation
9.12 Summary
Exercises
10 Finite sets
10.1 A representation of sets
10.2 Operations on sets
10.3 An abstype for sets
10.4 Other representations of sets
10.5 Summary
Exercises
11 Modules
11.1 Structures
11 .2 Specifkations and signatures
11.3 Signatures and structures
11 .4 Further facilities
11.5 Fixity of identifiers
11 .6 Functors
11 .7 Summary
Exercises
12 Tables
12.1 The table concept
12.2 A representation of tables
12.3 Operations on tables
12.4 Summary
Exercises
13 Problem solving III
13.1 Problem analysis
13.2 A sample run
13.3 Programming
13.4 Test
13.5 Summary
Exercises
14 Input/output in SML
14.1 Input streams
14.2 Output streams
14.3 Simple input and output
14.4 Use of conversions
14.5 Sequential composition
14.6 Input/output of composite data
14.7 Input with prompt and validation
14.8 Summary
Exercises
15 Interactive programs
15.1 A quiz program
15.2 Actions
15.3 Action schemas
15.4 Functions for action schemas
15.5 Dialogue automaton
15.6 Dialogue program
15.7 Action refinement
15.8 Summary
Exercises
16 Problem solving IV
16.1 Problem analysis
16.2 Programming
16.3 Test
16.4 Summary
Exercises
17 Iteration
17.1 Resource measures
17.2 Two problems
17.3 Solutions: accumulating parameters
17.4 Iteration
17.5 Summary
Exercises
18 Imperative programming
18.1 The store
18.2 Operations on the SML store
18.3 References and polymorphism
18.4 Arrays
18.5 The while loop
18.6 Imperative data structures
18.7 Summary
Exercises
Appendices
A SML systems
B Overview of Standard ML
B.l Lexical conventions
B.2 Syntax
B.3 Value, environment and store
B.4 Types
B.5 Semantics
C Overview of the SML module system
C.l Lexical conventions
C.2 Syntax
C.3 Interfaces and environments
C.4 Semantics
D Selected parts of the SML basis library
D.1 General
D.2 Numbers
D.3 Characters and strings
D.4 Lists
D.5 Vectors
D.6 Arrays
D.7 Timers and time
D.8 Date
D.9 Conversions
D.10 Text input
D.11 Text output
E Modules of sets and tables
E.1 Sets
E.2 Tables
E.3 Signatures
E.4 Structures
F The ASCII alphabet
G Further reading
Index

Introduction to programming using SML [1 ed.]
 0201398206, 9780201398205, 3143173203

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
Recommend Papers