HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Introducing functional programming in the Haskell language, this book is written for students and programmers with little or no experience. It emphasises the process of crafting programmes, problem solving and avoiding common programming pitfalls.
Covering basic functional programming, through abstraction to larger scale programming, students are lead step by step through the basics, before being introduced to more advanced topics.
This edition includes new material on testing and domain-specific languages and a variety of new examples and case studies, including simple games. Existing material has been expanded and re-ordered, so that some concepts such as simple data types and input/output are presented at an earlier stage.
Preface
1 Introducing functional programming
1.1 Computers and modelling
1.2 What is a function?
1.3 Pictures and functions
1.4 Types
1.5 The Haskell programming language
1.6 Expressions and evaluation
1.7 Definitions
1.8 Function definitions
1.9 Types and functional programming
1.10 Calculation and evaluation
1.11 The essence of Haskell programming
1.12 Domain-specific languages
1.13 Two models of Pictures
1.14 Tests, properties and proofs
2 Getting started with Haskell and GHCi
2.1 A first Haskell program
2.2 Using Haskell in practice
2.3 Using GHCi
2.4 The standard prelude and the Haskell libraries
2.5 Modules
2.6 A second example: Pictures
2.7 Errors and error messages
3 Basic types and definitions
3.1 The Booleans: Bool
3.2 The integers: Integer and Int
3.3 Overloading
3.4 Guards
3.5 Characters and strings
3.6 Floating-point numbers: Float
3.7 Syntax
4 Designing and writing programs
4.1 Where do I start? Designing a program in Haskell
4.2 Solving a problem in steps: local definitions
4.3 Defining types for ourselves: enumerated types
4.4 Recursion
4.5 Primitive recursion in practice
4.6 Extended exercise: pictures
4.7 General forms of recursion
4.8 Program testing
5 Data types, tuples and lists
5.1 Introducing tuples and lists
5.2 Tuple types
5.3 Introducing algebraic types
5.4 Our approach to lists
5.5 Lists in Haskell
5.6 List comprehensions
5.7 A library database
6 Programming with lists
6.1 Generic functions: polymorphism
6.2 Haskell list functions in the Prelude
6.3 Finding your way around the Haskell libraries
6.4 The Picture example: implementation
6.5 Extended exercise: alternative implementations of pictures
6.6 Extended exercise: positioned pictures
6.7 Extended exercise: supermarket billing
6.8 Extended exercise: cards and card games
7 Defining functions over lists
7.1 Pattern matching revisited
7.2 Lists and list patterns
7.3 Primitive recursion over lists
7.4 Finding primitive recursive definitions
7.5 General recursions over lists
7.6 Example: text processing
8 Playing the game: I/O in Haskell
8.1 Rock - Paper - Scissors: strategies
8.2 Why is I/O an issue?
8.3 The basics of input/output
8.4 The do notation
8.5 Loops and recursion
8.6 Rock - Paper - Scissors: playing the game
9 Reasoning about programs
9.1 Understanding definitions
9.2 Testing and proof
9.3 Definedness, termination and finiteness
9.4 A little logic
9.6 Further examples of proofs by induction
9.7 Generalizing the proof goal
10 Generalization: patterns of computation
10.1 Patterns of computation over lists
10.2 Higher-order functions: functions as arguments
10.3 Folding and primitive recursion
10.4 Generalizing: splitting up lists
10.5 Case studies revisited
11 Higher-order functions
11.1 Operators: function composition and application
11.2 Expressions for functions: lambda abstractions
11.3 Partial application
11.4 Under the hood: curried functions
11.5 Defining higher-order functions
11.6 Verification and general functions
12 Developing higher-order programs
12.1 Revisiting the Picture example
12.2 Functions as data: strategy combinators
12.3 Functions as data: recognising regular expressions
12.4 Case studies: functions as data
12.5 Example: creating an index
12.6 Development in practice