- Page 1 and 2: Programming in Standard ML (DRAFT:
- Page 3: Preface This book is an introductio
- Page 7 and 8: CONTENTS vi 3.5 Typing and Evaluati
- Page 9 and 10: CONTENTS viii 13.7 Sample Code . .
- Page 11 and 12: CONTENTS x 27 Proof-Directed Debugg
- Page 14 and 15: Part I Overview
- Page 16 and 17: Chapter 1 Programming in Standard M
- Page 18 and 19: 1.1 A Regular Expression Package 5
- Page 20 and 21: 1.1 A Regular Expression Package 7
- Page 22 and 23: 1.1 A Regular Expression Package 9
- Page 24 and 25: 1.1 A Regular Expression Package 11
- Page 26 and 27: Part II The Core Language
- Page 28 and 29: Chapter 2 Types, Values, and Effect
- Page 30 and 31: 2.2 The ML Computation Model 17 say
- Page 32 and 33: 2.2 The ML Computation Model 19 Why
- Page 34 and 35: 2.3 Types, Types, Types 21 2.3 Type
- Page 36 and 37: 2.4 Type Errors 23 if exp = false t
- Page 38 and 39: 3.2 Basic Bindings 25 the range of
- Page 40 and 41: 3.3 Compound Declarations 27 Math.s
- Page 42 and 43: 3.5 Typing and Evaluation 29 let in
- Page 44 and 45: 3.5 Typing and Evaluation 31 typenv
- Page 46 and 47: Chapter 4 Functions 4.1 Functions a
- Page 48 and 49: 4.2 Functions and Application 35 ma
- Page 50 and 51: 4.3 Binding and Scope, Revisited 37
- Page 52 and 53: 4.4 Sample Code 39 simultaneously (
- Page 54 and 55:
5.1 Product Types 41 Values of this
- Page 56 and 57:
5.1 Product Types 43 If we’d like
- Page 58 and 59:
5.2 Record Types 45 val (m:int, n:i
- Page 60 and 61:
5.2 Record Types 47 val {protocol=p
- Page 62 and 63:
5.3 Multiple Arguments and Multiple
- Page 64 and 65:
Chapter 6 Case Analysis 6.1 Homogen
- Page 66 and 67:
6.3 Booleans and Conditionals, Revi
- Page 68 and 69:
6.4 Exhaustiveness and Redundancy 5
- Page 70 and 71:
Chapter 7 Recursive Functions So fa
- Page 72 and 73:
7.1 Self-Reference and Recursion 59
- Page 74 and 75:
7.2 Iteration 61 3. 3 * 2 * factori
- Page 76 and 77:
7.3 Inductive Reasoning 63 2. A pro
- Page 78 and 79:
7.4 Mutual Recursion 65 (n-3) again
- Page 80 and 81:
Chapter 8 Type Inference and Polymo
- Page 82 and 83:
8.1 Type Inference 69 type of x to
- Page 84 and 85:
8.2 Polymorphic Definitions 71 is p
- Page 86 and 87:
8.3 Overloading 73 this case. This
- Page 88 and 89:
8.3 Overloading 75 let in end val d
- Page 90 and 91:
Chapter 9 Programming with Lists 9.
- Page 92 and 93:
9.2 Computing With Lists 79 and hen
- Page 94 and 95:
9.3 Sample Code 81 then the applica
- Page 96 and 97:
10.2 Non-Recursive Datatypes 83 con
- Page 98 and 99:
10.3 Recursive Datatypes 85 no reci
- Page 100 and 101:
10.3 Recursive Datatypes 87 a const
- Page 102 and 103:
10.5 Abstract Syntax 89 It is quite
- Page 104 and 105:
10.6 Sample Code 91 eval (Plus (Num
- Page 106 and 107:
11.2 Binding and Scope 93 1. Abstra
- Page 108 and 109:
11.3 Returning Functions 95 11.3 Re
- Page 110 and 111:
11.4 Patterns of Control 97 The pas
- Page 112 and 113:
11.5 Staging 99 multi-argument func
- Page 114 and 115:
11.5 Staging 101 The time saved by
- Page 116 and 117:
Chapter 12 Exceptions In chapter 2
- Page 118 and 119:
12.1 Exceptions as Errors 105 non-f
- Page 120 and 121:
12.2 Exception Handlers 107 end fac
- Page 122 and 123:
12.2 Exception Handlers 109 factori
- Page 124 and 125:
12.3 Value-Carrying Exceptions 111
- Page 126 and 127:
Chapter 13 Mutable Storage In this
- Page 128 and 129:
13.2 Reference Patterns 115 express
- Page 130 and 131:
13.3 Identity 117 2. Its visible si
- Page 132 and 133:
13.5 Programming Well With Referenc
- Page 134 and 135:
13.5 Programming Well With Referenc
- Page 136 and 137:
13.5 Programming Well With Referenc
- Page 138 and 139:
13.6 Mutable Arrays 125 ues of type
- Page 140 and 141:
Chapter 14 Input/Output The Standar
- Page 142 and 143:
14.2 Sample Code 129 available from
- Page 144 and 145:
131 suspension or a thunk. 2 This p
- Page 146 and 147:
15.2 Lazy Function Definitions 133
- Page 148 and 149:
15.3 Programming with Streams 135 v
- Page 150 and 151:
15.4 Sample Code 137 To inspect the
- Page 152 and 153:
Chapter 17 Concurrency Concurrent M
- Page 154 and 155:
141 The Standard ML module language
- Page 156 and 157:
18.1 Signatures 143 value component
- Page 158 and 159:
18.1 Signatures 145 signature QUEUE
- Page 160 and 161:
18.2 Structures 147 18.2 Structures
- Page 162 and 163:
18.2 Structures 149 val q = Queue.i
- Page 164 and 165:
Chapter 19 Signature Matching When
- Page 166 and 167:
19.2 Matching 153 exception id of t
- Page 168 and 169:
19.2 Matching 155 Matching does not
- Page 170 and 171:
19.3 Satisfaction 157 19.3 Satisfac
- Page 172 and 173:
20.2 Opaque Ascription 159 structur
- Page 174 and 175:
20.2 Opaque Ascription 161 signatur
- Page 176 and 177:
20.3 Transparent Ascription 163 str
- Page 178 and 179:
Chapter 21 Module Hierarchies So fa
- Page 180 and 181:
21.1 Substructures 167 structure My
- Page 182 and 183:
21.1 Substructures 169 end v Notice
- Page 184 and 185:
21.1 Substructures 171 structure St
- Page 186 and 187:
21.2 Sample Code 173 21.2 Sample Co
- Page 188 and 189:
22.1 Combining Abstractions 175 val
- Page 190 and 191:
22.1 Combining Abstractions 177 the
- Page 192 and 193:
22.1 Combining Abstractions 179 qui
- Page 194 and 195:
22.2 Sample Code 181 structure Sphe
- Page 196 and 197:
23.1 Functor Bindings and Applicati
- Page 198 and 199:
23.2 Functors and Sharing Specifica
- Page 200 and 201:
23.3 Avoiding Sharing Specification
- Page 202 and 203:
23.3 Avoiding Sharing Specification
- Page 204 and 205:
23.4 Sample Code 191 This solution
- Page 206 and 207:
193 In this part of the book we wil
- Page 208 and 209:
24.1 Specifications 195 • Equatio
- Page 210 and 211:
24.2 Correctness Proofs 197 There a
- Page 212 and 213:
24.3 Enforcement and Compliance 199
- Page 214 and 215:
24.3 Enforcement and Compliance 201
- Page 216 and 217:
25.1 Exponentiation 203 Does this f
- Page 218 and 219:
25.1 Exponentiation 205 You should
- Page 220 and 221:
25.2 The GCD Algorithm 207 adding a
- Page 222 and 223:
25.2 The GCD Algorithm 209 fun chec
- Page 224 and 225:
25.3 Sample Code 211 25.3 Sample Co
- Page 226 and 227:
26.1 Natural Numbers 213 Since N is
- Page 228 and 229:
26.3 Trees 215 This definition lice
- Page 230 and 231:
26.5 Abstracting Induction 217 The
- Page 232 and 233:
26.6 Sample Code 219 ’a -> (’b
- Page 234 and 235:
27.1 Regular Expressions and Langua
- Page 236 and 237:
27.2 Specifying the Matcher 223 tio
- Page 238 and 239:
27.2 Specifying the Matcher 225 | m
- Page 240 and 241:
27.2 Specifying the Matcher 227 cs
- Page 242 and 243:
Chapter 28 Persistent and Ephemeral
- Page 244 and 245:
231 More elaborate forms of ephemer
- Page 246 and 247:
28.1 Persistent Queues 233 val q1 =
- Page 248 and 249:
28.2 Amortized Analysis 235 Here’
- Page 250 and 251:
28.2 Amortized Analysis 237 and hen
- Page 252 and 253:
Chapter 29 Options, Exceptions, and
- Page 254 and 255:
29.2 Solution Using Options 241 end
- Page 256 and 257:
29.3 Solution Using Exceptions 243
- Page 258 and 259:
29.4 Solution Using Continuations 2
- Page 260 and 261:
Chapter 30 Higher-Order Functions H
- Page 262 and 263:
30.1 Infinite Sequences 249 paramet
- Page 264 and 265:
30.2 Circuit Simulation 251 fun fib
- Page 266 and 267:
30.2 Circuit Simulation 253 | gate
- Page 268 and 269:
30.3 Regular Expression Matching, R
- Page 270 and 271:
Chapter 31 Memoization In this chap
- Page 272 and 273:
31.2 Laziness 259 end else p’ n e
- Page 274 and 275:
31.3 Lazy Data Types in SML/NJ 261
- Page 276 and 277:
31.4 Recursive Suspensions 263 31.4
- Page 278 and 279:
Chapter 32 Data Abstraction An abst
- Page 280 and 281:
32.2 Binary Search Trees 267 binary
- Page 282 and 283:
32.3 Balanced Binary Search Trees 2
- Page 284 and 285:
32.3 Balanced Binary Search Trees 2
- Page 286 and 287:
32.5 Sample Code 273 . end structur
- Page 288 and 289:
Chapter 34 Modularity and Reuse 1.
- Page 290 and 291:
Chapter 36 Concurrency In this chap
- Page 292 and 293:
Appendix A The Standard ML Basis Li
- Page 294 and 295:
B.1 Overview of CM 281 B.1 Overview
- Page 296 and 297:
Revision History Revision Date Auth