Book Cover --;Title --;Copyright --;Contents --;Preface --;CHAPTER 1 Introduction --;1.1 Introduction --;1.2 Making models --;1.3 Things, collections and properties --;1.4 Properties of properties --;1.5 Types and methods --;1.6 Choosing types --;1.7 Characterizing things and collections --;1.8 New types from old types --;1.9 The story so far --;1.10 Expressions from methods --;1.11 Generalizing through naming --;1.12 Specializing abstractions --;1.13 Abstraction by comparison --;1.14 Naming functions --;1.15 Deciding what to do next --;1.16 Names are arbitrary --;1.17 New collections from old collections --;1.18 Mapping --;1.19 Filtering --;1.20 Folding --;1.21 Checking --;1.22 Higher order functions --;1.23 Naming and recursion --;1.24 Summary --;1.25 Book structure --;1.26 Syntax notation --;1.27 Typefaces --;1.28 Exercises --;CHAPTER 2 Basic types --;2.1 Introduction --;2.2 Expressions and types --;2.3 Basic system use --;2.4 Boolean type --;2.5 Case sensitivity --;2.6 Integer type --;2.7 Real type --;2.8 Numeric precision --;2.9 String type --;2.10 Tuple type --;2.11 Function type overview --;2.12 Boolean operators --;2.13 Precedence and boolean expressions --;2.14 Integer operators --;2.15 Tuple type operators --;2.16 Real operators --;2.17 Overloaded operators --;2.18 Mixed type arithmetic --;2.19 String operators --;2.20 Comparison operators --;2.21 Boolean comparison --;2.22 Real comparison --;2.23 Division and remainder with a negative operand --;2.24 Tuples with expressions --;2.25 Function composition --;2.26 Introducing exceptions --;2.27 Summary --;2.28 Exercises --;CHAPTER 3 Global declarations and functions --;3.1 Introduction --;3.2 Names --;3.3 Reserved words --;3.4 Global declarations --;3.5 Functions --;3.6 Naming functions --;3.7 Comments --;3.8 Making the bound variable type explicit --;3.9 Abstraction over functions. 3.10 Introducing higher order functions --;3.11 Introducing polymorphism --;3.12 Function composition function --;3.13 Scope --;3.14 Illustrating function application --;3.15 Testing --;3.16 Summary --;3.17 Exercises --;CHAPTER 4 Pattern matching and recursion --;4.1 Simplified notations --;4.2 Tables and functions --;4.3 Pattern matching --;4.4 Pattern matching with strings --;4.5 Raising exceptions --;4.6 Wildcard pattern matching --;4.7 Pattern matching with booleans --;4.8 Recursion with integers --;4.9 Generalizing summing integer sequences --;4.10 Conditional expression --;4.11 Conditional expressions and boolean values --;4.12 Pattern matching with reals --;4.13 More testing --;4.14 Summary --;4.15 Exercises --;CHAPTER 5 Introducing lists --;5.1 Introduction --;5.2 Basic list values --;5.3 Pattern matching with lists --;5.4 Equality types --;5.5 General list operations --;5.5.1 Add to end of list --;5.5.2 Append two lists end to end --;5.5.3 Insert before value in list --;5.5.4 Delete value from list --;5.5.5 Replace value in list --;5.6 Explicit list element selection --;5.7 Indexed list access --;5.8 Testing list functions --;5.9 Summary --;5.10 Exercises --;CHAPTER 6 List higher order functions --;6.1 Accumulation variables --;6.2 Encapsulation with local declarations --;6.3 Ascending sequences --;6.4 List reversal --;6.5 List mapping --;6.6 List filtering --;6.7 Ordered lists --;6.8 Insertion into ordered lists --;6.9 Layered patterns --;6.10 Insertion sort --;6.11 Mapping over two lists --;6.12 Merge sort --;6.13 Folding lists of lists --;6.14 Generalized folding --;6.15 Testing groups of functions --;6.16 Summary --;6.17 Exercises --;CHAPTER 7 Tuple lists --;7.1 Introduction --;7.2 Pattern matching with tuples --;7.3 Tuples for accumulation variables --;7.4 Pattern matching with lists of tuples --;7.5 Accumulation with lists. 7.6 Generalized list find, delete and replace --;7.7 Example-telephone directory --;7.8 Example-stock control --;7.9 Type expressions and type abbreviations --;7.10 Curried and uncurried functions --;7.11 Summary --;7.12 Exercises --;CHAPTER 8 Text processing --;8.1 Introduction --;8.2 --;8.3 Text editing --;8.3.1 Does one string start another? --;8.3.2. Does one string contain another? --;8.3.3 Delete one string from another --;8.3.4 Insert one string before another in a third string --;8.3.5 Insert one string after another in a third string --;8.3.6 Replace one string with another in a third string --;8.4 Digit string to number value conversion --;8.5 Let expression --;8.6 Unzip revisited --;8.7 Finding words in a string --;8.8 Counting words --;8.9 Summary --;8.10 Exercises --;CHAPTER 9 Concrete data types --;9.1 Introduction --;9.2 New types --;9.3 Example-simple lexical analysis --;9.4 Structured datatype binding --;9.5 Structured pattern matching --;9.6 Union types --;9.7 Example-converting digit strings to number lists --;9.8 Example-lexical analysis of arithmetic expressions --;9.8.1. Introduction --;9.8.2 Analyzer function --;9.8.3 Mutual declarations --;9.8.4 Recognizing identifiers --;9.8.5 Recognizing integers --;9.8.6 Complete analyzer --;9.8.7 Pretty printer --;9.9 Pattern matching summary --;9.10 Summary --;9.11 Exercises --;CHAPTER 10 Defining lists and trees --;10.1 Linked structures --;10.2 String linked lists --;10.3 Generalized lists --;10.4 List efficiency --;10.5 Introducing trees --;10.6 Binary tree datatype --;10.7 Polymorphic trees --;10.8 Grammar and parsing --;10.9 Parse trees --;10.10 Concrete and abstract syntax --;10.11 Parsing arithmetic expressions --;10.12 Case expression --;10.13 Multiple exceptions --;10.14 Interpreting arithmetic expressions --;10.15 Arithmetic pretty printer --;10.16 Summary --;10.17 Exercises. CHAPTER 11 Input and output --;11.1 Introduction --;11.2 Unit type --;11.3 Screen output --;11.4 String list output --;11.5 Integer list output --;11.6 Formatted output --;11.7 Keyboard input --;11.8 Interactive I/O --;11.9 Handling exceptions --;11.10 File output --;11.11 Sequenced file output --;11.12 File input --;11.13 Sequenced file input --;11.14 Summary --;11.15 Exercises --;CHAPTER 12 Further SML --;12.1 Introduction --;12.2 Functional and imperative languages --;12.2.1 Imperative aspects of SML --;12.2.2 Replacing recursion with iteration --;12.2.3 Replacing copying with assignment --;12.3 Encapsulation with abstract types and modules --;12.3.1 Abstract types --;12.3.2 Structures --;12.4 Other features --;12.5 Further reading --;12.6 SML implementations --;APPENDIX A Using an SML system --;A.1 Introduction --;A.2 Getting started --;A.3 Leaving the system --;A.4 Panic button --;A.5 Program development --;A.6 Saving system output --;APPENDIX B SML syntax --;APPENDIX C SML standard functions and operators --;C.1 Standard functions --;C.2 I/O streams and functions --;C.3 Standard operators --;Word index --;Function index.
If we want to solve a problem then one approach is to make a model which captures important aspects of the circumstances of the problem. If the model is accurate and detailed enough then working with it should shed further light on the problem. Usually, a model means a simplified physical replica of something. For example, many childrens' toys are models of far more complexdevices. Models may be constructed at differing levels of closeness to the thing being modelled. For example, a basic toy car has four wheelsso that it can be pushed across a floor. A more complex model might have steerable wheels. An even more detailed model might have anelectric motor so that it does not need to be pushed. Finally, the model might have remote control so that its speed and direction can bechanged without direct contact.