- Page 1: Programming in Standard ML (DRAFT:
- Page 6 and 7: Contents Preface ii I Overview 1 1
- Page 8 and 9: CONTENTS vii 9 Programming with Lis
- Page 10 and 11: CONTENTS ix 20.3 Transparent Ascrip
- Page 12: CONTENTS xi 34 Modularity and Reuse
- Page 15 and 16: 2 Standard ML is a type-safe progra
- Page 17 and 18: 1.1 A Regular Expression Package 4
- Page 19 and 20: 1.1 A Regular Expression Package 6
- Page 21 and 22: 1.1 A Regular Expression Package 8
- Page 23 and 24: 1.1 A Regular Expression Package 10
- Page 25 and 26: 1.2 Sample Code 12 by the iteration
- Page 27 and 28: 14 All Standard ML is divided into
- Page 29 and 30: 2.2 The ML Computation Model 16 str
- Page 31 and 32: 2.2 The ML Computation Model 18 Oft
- Page 33 and 34: 2.2 The ML Computation Model 20 the
- Page 35 and 36: 2.3 Types, Types, Types 22 3+3.14 i
- Page 37 and 38: Chapter 3 Declarations 3.1 Variable
- Page 39 and 40: 3.2 Basic Bindings 26 3.2.2 Value B
- Page 41 and 42: 3.4 Limiting Scope 28 are nested wi
- Page 43 and 44: 3.5 Typing and Evaluation 30 enviro
- Page 45 and 46: 3.6 Sample Code 32 In words, if the
- Page 47 and 48: 4.2 Functions and Application 34 al
- Page 49 and 50: 4.2 Functions and Application 36 wh
- Page 51 and 52: 4.3 Binding and Scope, Revisited 38
- Page 53 and 54:
Chapter 5 Products and Records 5.1
- Page 55 and 56:
5.1 Product Types 42 val pair : int
- Page 57 and 58:
5.1 Product Types 44 val (m:int,n:i
- Page 59 and 60:
5.2 Record Types 46 val {lab 1 =pat
- Page 61 and 62:
5.3 Multiple Arguments and Multiple
- Page 63 and 64:
5.4 Sample Code 50 5.4 Sample Code
- Page 65 and 66:
6.2 Clausal Function Expressions 52
- Page 67 and 68:
6.4 Exhaustiveness and Redundancy 5
- Page 69 and 70:
6.5 Sample Code 56 When applied to,
- Page 71 and 72:
7.1 Self-Reference and Recursion 58
- Page 73 and 74:
7.1 Self-Reference and Recursion 60
- Page 75 and 76:
7.3 Inductive Reasoning 62 local in
- Page 77 and 78:
7.3 Inductive Reasoning 64 factoria
- Page 79 and 80:
7.5 Sample Code 66 are said to be m
- Page 81 and 82:
8.1 Type Inference 68 missing type
- Page 83 and 84:
8.2 Polymorphic Definitions 70 is a
- Page 85 and 86:
8.2 Polymorphic Definitions 72 the
- Page 87 and 88:
8.3 Overloading 74 1. Declare the e
- Page 89 and 90:
8.4 Sample Code 76 because what hap
- Page 91 and 92:
9.1 List Primitives 78 to get anoth
- Page 93 and 94:
9.2 Computing With Lists 80 fun rev
- Page 95 and 96:
Chapter 10 Concrete Data Types 10.1
- Page 97 and 98:
10.2 Non-Recursive Datatypes 84 dat
- Page 99 and 100:
10.3 Recursive Datatypes 86 (Incide
- Page 101 and 102:
10.4 Heterogeneous Data Structures
- Page 103 and 104:
10.5 Abstract Syntax 90 datatype ex
- Page 105 and 106:
Chapter 11 Higher-Order Functions 1
- Page 107 and 108:
11.2 Binding and Scope 94 val x = 2
- Page 109 and 110:
11.3 Returning Functions 96 “retr
- Page 111 and 112:
11.4 Patterns of Control 98 fun red
- Page 113 and 114:
11.5 Staging 100 fun staged reduce
- Page 115 and 116:
11.6 Sample Code 102 11.6 Sample Co
- Page 117 and 118:
12.1 Exceptions as Errors 104 12.1
- Page 119 and 120:
12.1 Exceptions as Errors 106 in me
- Page 121 and 122:
12.2 Exception Handlers 108 exc is
- Page 123 and 124:
12.3 Value-Carrying Exceptions 110
- Page 125 and 126:
12.4 Sample Code 112 exn as argumen
- Page 127 and 128:
13.1 Reference Cells 114 contrast t
- Page 129 and 130:
13.3 Identity 116 An alternative to
- Page 131 and 132:
13.4 Aliasing 118 val r = ref () va
- Page 133 and 134:
13.5 Programming Well With Referenc
- Page 135 and 136:
13.5 Programming Well With Referenc
- Page 137 and 138:
13.6 Mutable Arrays 124 The last st
- Page 139 and 140:
13.7 Sample Code 126 end of SOME r
- Page 141 and 142:
14.1 Textual Input/Output 128 sink.
- Page 143 and 144:
Chapter 15 Lazy Data Structures In
- Page 145 and 146:
15.1 Lazy Data Types 132 on which s
- Page 147 and 148:
15.2 Lazy Function Definitions 134
- Page 149 and 150:
15.3 Programming with Streams 136 t
- Page 151 and 152:
Chapter 16 Equality and Equality Ty
- Page 153 and 154:
Part III The Module Language
- Page 155 and 156:
Chapter 18 Signatures and Structure
- Page 157 and 158:
18.1 Signatures 144 where sigid is
- Page 159 and 160:
18.1 Signatures 146 signature QUEUE
- Page 161 and 162:
18.2 Structures 148 evaluating the
- Page 163 and 164:
18.3 Sample Code 150 Another proble
- Page 165 and 166:
19.1 Principal Signatures 152 19.1
- Page 167 and 168:
19.2 Matching 154 The candidate may
- Page 169 and 170:
19.2 Matching 156 value components
- Page 171 and 172:
Chapter 20 Signature Ascription Sig
- Page 173 and 174:
20.2 Opaque Ascription 160 The use
- Page 175 and 176:
20.3 Transparent Ascription 162 cas
- Page 177 and 178:
20.4 Sample Code 164 The ascription
- Page 179 and 180:
21.1 Substructures 166 To see how s
- Page 181 and 182:
21.1 Substructures 168 Node of ’a
- Page 183 and 184:
21.1 Substructures 170 struct type
- Page 185 and 186:
21.1 Substructures 172 end Similarl
- Page 187 and 188:
Chapter 22 Sharing Specifications I
- Page 189 and 190:
22.1 Combining Abstractions 176 As
- Page 191 and 192:
22.1 Combining Abstractions 178 str
- Page 193 and 194:
22.1 Combining Abstractions 180 But
- Page 195 and 196:
Chapter 23 Parameterization To supp
- Page 197 and 198:
23.1 Functor Bindings and Applicati
- Page 199 and 200:
23.2 Functors and Sharing Specifica
- Page 201 and 202:
23.3 Avoiding Sharing Specification
- Page 203 and 204:
23.3 Avoiding Sharing Specification
- Page 205 and 206:
Part IV Programming Techniques
- Page 207 and 208:
Chapter 24 Specifications and Corre
- Page 209 and 210:
24.2 Correctness Proofs 196 in (a+b
- Page 211 and 212:
24.2 Correctness Proofs 198 branch
- Page 213 and 214:
24.3 Enforcement and Compliance 200
- Page 215 and 216:
Chapter 25 Induction and Recursion
- Page 217 and 218:
25.1 Exponentiation 204 expressing
- Page 219 and 220:
25.1 Exponentiation 206 if n ≥ 0,
- Page 221 and 222:
25.2 The GCD Algorithm 208 then eit
- Page 223 and 224:
25.2 The GCD Algorithm 210 let in e
- Page 225 and 226:
Chapter 26 Structural Induction The
- Page 227 and 228:
26.2 Lists 214 representation. This
- Page 229 and 230:
26.4 Generalizations and Limitation
- Page 231 and 232:
26.5 Abstracting Induction 218 Note
- Page 233 and 234:
Chapter 27 Proof-Directed Debugging
- Page 235 and 236:
27.2 Specifying the Matcher 222 and
- Page 237 and 238:
27.2 Specifying the Matcher 224 Obs
- Page 239 and 240:
27.2 Specifying the Matcher 226 tru
- Page 241 and 242:
27.3 Sample Code 228 The function
- Page 243 and 244:
230 because they persist after appl
- Page 245 and 246:
28.1 Persistent Queues 232 to be us
- Page 247 and 248:
28.1 Persistent Queues 234 “halve
- Page 249 and 250:
28.2 Amortized Analysis 236 the wor
- Page 251 and 252:
28.3 Sample Code 238 28.3 Sample Co
- Page 253 and 254:
29.1 The n-Queens Problem 240 decis
- Page 255 and 256:
29.3 Solution Using Exceptions 242
- Page 257 and 258:
29.4 Solution Using Continuations 2
- Page 259 and 260:
29.5 Sample Code 246 29.5 Sample Co
- Page 261 and 262:
30.1 Infinite Sequences 248 30.1 In
- Page 263 and 264:
30.1 Infinite Sequences 250 (* bad
- Page 265 and 266:
30.2 Circuit Simulation 252 datatyp
- Page 267 and 268:
30.3 Regular Expression Matching, R
- Page 269 and 270:
30.4 Sample Code 256 char list -> (
- Page 271 and 272:
31.1 Cacheing Results 258 where sum
- Page 273 and 274:
31.2 Laziness 260 so that the suspe
- Page 275 and 276:
31.3 Lazy Data Types in SML/NJ 262
- Page 277 and 278:
31.5 Sample Code 264 31.5 Sample Co
- Page 279 and 280:
32.1 Dictionaries 266 32.1 Dictiona
- Page 281 and 282:
32.3 Balanced Binary Search Trees 2
- Page 283 and 284:
32.3 Balanced Binary Search Trees 2
- Page 285 and 286:
32.4 Abstraction vs. Run-Time Check
- Page 287 and 288:
Chapter 33 Representation Independe
- Page 289 and 290:
Chapter 35 Dynamic Typing and Dynam
- Page 291 and 292:
Part V Appendices
- Page 293 and 294:
Appendix B Compilation Management A
- Page 295 and 296:
Appendix C Sample Programs A number
- Page 297:
Bibliography [1] Emden R. Gansner a