| Introduction |
|
1 | (6) |
|
|
|
1 | (2) |
|
|
|
3 | (1) |
|
|
|
3 | (1) |
|
|
|
4 | (1) |
|
|
|
5 | (2) |
|
PART 1 GETTING STARTED WITH FUNCTIONAL PROGRAMMING |
|
|
7 | (56) |
|
Chapter 1 Introducing Functional Programming |
|
|
9 | (10) |
|
Defining Functional Programming |
|
|
10 | (3) |
|
|
|
11 | (1) |
|
|
|
11 | (1) |
|
Using the impure approach |
|
|
12 | (1) |
|
Considering Other Programming Paradigms |
|
|
13 | (2) |
|
|
|
13 | (1) |
|
|
|
13 | (1) |
|
|
|
14 | (1) |
|
|
|
14 | (1) |
|
Using Functional Programming to Perform Tasks |
|
|
15 | (1) |
|
Discovering Languages That Support Functional Programming |
|
|
16 | (1) |
|
Considering the pure languages |
|
|
16 | (1) |
|
Considering the impure languages |
|
|
17 | (1) |
|
Finding Functional Programming Online |
|
|
17 | (2) |
|
Chapter 2 Getting and Using Python |
|
|
19 | (28) |
|
Working with Python in This Book |
|
|
20 | (1) |
|
|
|
20 | (1) |
|
|
|
20 | (1) |
|
Defining why notebooks are useful |
|
|
21 | (1) |
|
Obtaining Your Copy of Anaconda |
|
|
21 | (6) |
|
Obtaining Analytics Anaconda |
|
|
21 | (1) |
|
Installing Anaconda on Linux |
|
|
22 | (1) |
|
Installing Anaconda on MacOS |
|
|
23 | (1) |
|
Installing Anaconda on Windows |
|
|
24 | (2) |
|
Understanding the Anaconda package |
|
|
26 | (1) |
|
Downloading the Datasets and Example Code |
|
|
27 | (7) |
|
|
|
28 | (1) |
|
Defining the code repository |
|
|
28 | (5) |
|
Getting and using datasets |
|
|
33 | (1) |
|
Creating a Python Application |
|
|
34 | (4) |
|
|
|
35 | (1) |
|
Adding documentation cells |
|
|
36 | (2) |
|
|
|
38 | (1) |
|
Running the Python Application |
|
|
38 | (1) |
|
Understanding the Use of Indentation |
|
|
39 | (2) |
|
|
|
41 | (3) |
|
|
|
41 | (2) |
|
Using comments to leave yourself reminders |
|
|
43 | (1) |
|
Using comments to keep code from executing |
|
|
43 | (1) |
|
|
|
44 | (1) |
|
Getting Help with the Python Language |
|
|
45 | (2) |
|
Chapter 3 Getting and Using Haskell |
|
|
47 | (16) |
|
Working with Haskell in This Book |
|
|
48 | (1) |
|
Obtaining and Installing Haskell |
|
|
48 | (6) |
|
Installing Haskell on a Linux system |
|
|
50 | (1) |
|
Installing Haskell on a Mac system |
|
|
50 | (2) |
|
Installing Haskell on a Windows system |
|
|
52 | (2) |
|
Testing the Haskell Installation |
|
|
54 | (2) |
|
Compiling a Haskell Application |
|
|
56 | (3) |
|
|
|
59 | (1) |
|
Getting Help with the Haskell Language |
|
|
60 | (3) |
|
PART 2 STARTING FUNCTIONAL PROGRAMMING TASKS |
|
|
63 | (46) |
|
Chapter 4 Defining the Functional Difference |
|
|
65 | (12) |
|
Comparing Declarations to Procedures |
|
|
66 | (1) |
|
Understanding How Data Works |
|
|
67 | (2) |
|
Working with immutable data |
|
|
68 | (1) |
|
Considering the role of state |
|
|
68 | (1) |
|
|
|
69 | (1) |
|
Seeing a Function in Haskell |
|
|
69 | (4) |
|
Using non-curried functions |
|
|
69 | (1) |
|
|
|
70 | (3) |
|
Seeing a Function in Python |
|
|
73 | (4) |
|
Creating and using a Python function |
|
|
73 | (1) |
|
Passing by reference versus by value |
|
|
74 | (3) |
|
Chapter 5 Understanding the Role of Lambda Calculus |
|
|
77 | (14) |
|
Considering the Origins of Lambda Calculus |
|
|
78 | (2) |
|
|
|
80 | (5) |
|
|
|
80 | (1) |
|
|
|
81 | (1) |
|
|
|
82 | (3) |
|
Performing Reduction Operations |
|
|
85 | (4) |
|
|
|
85 | (1) |
|
|
|
86 | (2) |
|
|
|
88 | (1) |
|
Creating Lambda Functions in Haskell |
|
|
89 | (1) |
|
Creating Lambda Functions in Python |
|
|
89 | (2) |
|
Chapter 6 Working with Lists and Strings |
|
|
91 | (18) |
|
|
|
92 | (1) |
|
|
|
93 | (3) |
|
Using Haskell to create Lists |
|
|
94 | (1) |
|
Using Python to create lists |
|
|
95 | (1) |
|
|
|
96 | (4) |
|
Using Haskell to evaluate Lists |
|
|
97 | (2) |
|
Using Python to evaluate lists |
|
|
99 | (1) |
|
Performing Common List Manipulations |
|
|
100 | (3) |
|
Understanding the list manipulation functions |
|
|
101 | (1) |
|
Using Haskell to manipulate lists |
|
|
101 | (1) |
|
Using Python to manipulate lists |
|
|
102 | (1) |
|
Understanding the Dictionary and Set Alternatives |
|
|
103 | (2) |
|
|
|
103 | (1) |
|
|
|
104 | (1) |
|
Considering the Use of Strings |
|
|
105 | (4) |
|
Understanding the uses for strings |
|
|
105 | (1) |
|
Performing string-related tasks in Haskell |
|
|
106 | (1) |
|
Performing string-related tasks in Python |
|
|
106 | (3) |
|
PART 3 MAKING FUNCTIONAL PROGRAMMING PRACTICAL |
|
|
109 | (74) |
|
Chapter 7 Performing Pattern Matching |
|
|
111 | (14) |
|
Looking for Patterns in Data |
|
|
112 | (1) |
|
Understanding Regular Expressions |
|
|
113 | (4) |
|
Defining special characters using escapes |
|
|
114 | (1) |
|
Defining wildcard characters |
|
|
115 | (1) |
|
|
|
115 | (1) |
|
Delineating subexpressions using grouping constructs |
|
|
116 | (1) |
|
Using Pattern Matching in Analysis |
|
|
117 | (1) |
|
Working with Pattern Matching in Haskell |
|
|
118 | (3) |
|
Performing simple Posix matches |
|
|
118 | (2) |
|
Matching a telephone number with Haskell |
|
|
120 | (1) |
|
Working with Pattern Matching in Python |
|
|
121 | (4) |
|
Performing simple Python matches |
|
|
121 | (2) |
|
|
|
123 | (1) |
|
Matching a telephone number with Python |
|
|
124 | (1) |
|
Chapter 8 Using Recursive Functions |
|
|
125 | (18) |
|
Performing Tasks More than Once |
|
|
126 | (2) |
|
Defining the need for repetition |
|
|
126 | (1) |
|
Using recursion instead of looping |
|
|
127 | (1) |
|
|
|
128 | (7) |
|
Considering basic recursion |
|
|
129 | (2) |
|
Performing tasks using lists |
|
|
131 | (1) |
|
Upgrading to set and dictionary |
|
|
132 | (2) |
|
Considering the use of collections |
|
|
134 | (1) |
|
|
|
135 | (2) |
|
|
|
135 | (1) |
|
|
|
136 | (1) |
|
Passing Functions Instead of Variables |
|
|
137 | (3) |
|
Understanding when you need a function |
|
|
138 | (1) |
|
Passing functions in Haskell |
|
|
138 | (1) |
|
Passing functions in Python |
|
|
139 | (1) |
|
Defining Common Recursion Errors |
|
|
140 | (3) |
|
|
|
140 | (1) |
|
|
|
141 | (1) |
|
Defining a correct base instruction |
|
|
141 | (2) |
|
Chapter 9 Advancing with Higher-Order Functions |
|
|
143 | (18) |
|
Considering Types of Data Manipulation |
|
|
144 | (2) |
|
Performing Slicing and Dicing |
|
|
146 | (5) |
|
Keeping datasets controlled |
|
|
146 | (1) |
|
Focusing on specific data |
|
|
147 | (1) |
|
Slicing and dicing with Haskell |
|
|
147 | (3) |
|
Slicing and dicing with Python |
|
|
150 | (1) |
|
|
|
151 | (3) |
|
Understanding the purpose of mapping |
|
|
151 | (1) |
|
Performing mapping tasks with Haskell |
|
|
152 | (1) |
|
Performing mapping tasks with Python |
|
|
153 | (1) |
|
|
|
154 | (3) |
|
Understanding the purpose of filtering |
|
|
154 | (1) |
|
Using Haskell to filter data |
|
|
155 | (1) |
|
Using Python to filter data |
|
|
156 | (1) |
|
|
|
157 | (4) |
|
Considering the types of organization |
|
|
157 | (1) |
|
Sorting data with Haskell |
|
|
158 | (1) |
|
|
|
159 | (2) |
|
Chapter 10 Dealing with Types |
|
|
161 | (22) |
|
|
|
162 | (8) |
|
Understanding the functional perception of type |
|
|
162 | (1) |
|
Considering the type signature |
|
|
162 | (2) |
|
|
|
164 | (6) |
|
|
|
170 | (6) |
|
|
|
170 | (4) |
|
Considering the use of Nothing, Maybe, and Just |
|
|
174 | (2) |
|
|
|
176 | (1) |
|
|
|
176 | (2) |
|
Dealing with Missing Data |
|
|
178 | (3) |
|
|
|
178 | (2) |
|
Performing data replacement |
|
|
180 | (1) |
|
Considering statistical measures |
|
|
180 | (1) |
|
Creating and Using Type Classes |
|
|
181 | (2) |
|
PART 4 INTERACTING IN VARIOUS WAYS |
|
|
183 | (64) |
|
Chapter 11 Performing Basic I/O |
|
|
185 | (12) |
|
Understanding the Essentials of I/O |
|
|
186 | (5) |
|
Understanding I/O side effects |
|
|
186 | (2) |
|
|
|
188 | (1) |
|
Interacting with the user |
|
|
188 | (1) |
|
|
|
189 | (2) |
|
|
|
191 | (1) |
|
Using the Jupyter Notebook Magic Functions |
|
|
192 | (3) |
|
Receiving and Sending I/O with Haskell |
|
|
195 | (2) |
|
|
|
195 | (1) |
|
Employing monad functions |
|
|
195 | (2) |
|
Chapter 12 Handling the Command Line |
|
|
197 | (10) |
|
Getting Input from the Command Line |
|
|
198 | (2) |
|
Automating the command line |
|
|
198 | (1) |
|
Considering the use of prompts |
|
|
198 | (1) |
|
Using the command line effectively |
|
|
199 | (1) |
|
Accessing the Command Line in Haskell |
|
|
200 | (5) |
|
Using the Haskell environment directly |
|
|
200 | (1) |
|
Making sense of the variety of packages |
|
|
201 | (1) |
|
|
|
202 | (2) |
|
Getting a simple command line in Haskell |
|
|
204 | (1) |
|
Accessing the Command Line in Python |
|
|
205 | (2) |
|
Using the Python environment directly |
|
|
205 | (1) |
|
Interacting with Argparse |
|
|
206 | (1) |
|
Chapter 13 Dealing with Files |
|
|
207 | (12) |
|
Understanding How Local Files are Stored |
|
|
208 | (1) |
|
|
|
209 | (1) |
|
|
|
209 | (3) |
|
|
|
210 | (1) |
|
|
|
211 | (1) |
|
Manipulating File Content |
|
|
212 | (5) |
|
|
|
213 | (1) |
|
|
|
214 | (1) |
|
|
|
215 | (2) |
|
Completing File-related Tasks |
|
|
217 | (2) |
|
Chapter 14 Working with Binary Data |
|
|
219 | (12) |
|
Comparing Binary to Textual Data |
|
|
220 | (1) |
|
Using Binary Data in Data Analysis |
|
|
221 | (1) |
|
Understanding the Binary Data Format |
|
|
222 | (3) |
|
|
|
225 | (1) |
|
Interacting with Binary Data in Haskell |
|
|
225 | (3) |
|
Writing binary data using Haskell |
|
|
226 | (1) |
|
Reading binary data using Haskell |
|
|
227 | (1) |
|
Interacting with Binary Data in Python |
|
|
228 | (3) |
|
Writing binary data using Python |
|
|
228 | (1) |
|
Reading binary data using Python |
|
|
229 | (2) |
|
Chapter 15 Dealing with Common Datasets |
|
|
231 | (16) |
|
Understanding the Need for Standard Datasets |
|
|
232 | (1) |
|
Finding the Right Dataset |
|
|
233 | (3) |
|
Locating general dataset information |
|
|
233 | (1) |
|
Using library-specific datasets |
|
|
234 | (2) |
|
|
|
236 | (5) |
|
Working with toy datasets |
|
|
237 | (1) |
|
|
|
238 | (1) |
|
|
|
239 | (2) |
|
Manipulating Dataset Entries |
|
|
241 | (6) |
|
Determining the dataset content |
|
|
241 | (2) |
|
|
|
243 | (1) |
|
Accessing specific records |
|
|
244 | (3) |
|
PART 5 PERFORMING SIMPLE ERROR TRAPPING |
|
|
247 | (22) |
|
Chapter 16 Handling Errors in Haskell |
|
|
249 | (10) |
|
Defining a Bug in Haskell |
|
|
250 | (3) |
|
|
|
250 | (1) |
|
|
|
251 | (1) |
|
|
|
252 | (1) |
|
Considering implementation-specific issues |
|
|
253 | (1) |
|
Understanding the Haskell-Related Errors |
|
|
253 | (3) |
|
Fixing Haskell Errors Quickly |
|
|
256 | (3) |
|
Relying on standard debugging |
|
|
256 | (2) |
|
Understanding errors versus exceptions |
|
|
258 | (1) |
|
Chapter 17 Handling Errors in Python |
|
|
259 | (10) |
|
|
|
260 | (3) |
|
Considering the sources of errors |
|
|
260 | (2) |
|
Considering version differences |
|
|
262 | (1) |
|
Understanding the Python-Related Errors |
|
|
263 | (2) |
|
Dealing with late binding closures |
|
|
263 | (1) |
|
|
|
264 | (1) |
|
Working with third-party libraries |
|
|
264 | (1) |
|
Fixing Python Errors Quickly |
|
|
265 | (4) |
|
Understanding the built-in exceptions |
|
|
265 | (1) |
|
Obtaining a list of exception arguments |
|
|
266 | (1) |
|
Considering functional style exception handling |
|
|
267 | (2) |
|
|
|
269 | (28) |
|
Chapter 18 Ten Must-Have Haskell Libraries |
|
|
271 | (8) |
|
|
|
271 | (2) |
|
|
|
273 | (1) |
|
|
|
273 | (1) |
|
|
|
274 | (1) |
|
|
|
274 | (1) |
|
|
|
275 | (1) |
|
|
|
275 | (1) |
|
|
|
276 | (1) |
|
|
|
276 | (1) |
|
|
|
277 | (2) |
|
Chapter 19 Ten (Plus) Must-Have Python Packages |
|
|
279 | (10) |
|
|
|
280 | (1) |
|
|
|
281 | (1) |
|
|
|
282 | (1) |
|
|
|
283 | (1) |
|
|
|
283 | (1) |
|
|
|
284 | (1) |
|
|
|
284 | (1) |
|
|
|
285 | (1) |
|
|
|
285 | (1) |
|
|
|
286 | (1) |
|
|
|
287 | (2) |
|
Chapter 20 Ten Occupation Areas that Use Functional Programming |
|
|
289 | (8) |
|
Starting with Traditional Development |
|
|
289 | (1) |
|
Going with New Development |
|
|
290 | (1) |
|
Creating Your Own Development |
|
|
291 | (1) |
|
Finding a Forward-Thinking Business |
|
|
292 | (1) |
|
Doing Something Really Interesting |
|
|
292 | (1) |
|
Developing Deep Learning Applications |
|
|
293 | (1) |
|
|
|
293 | (1) |
|
Helping Others in the Health Care Arena |
|
|
294 | (1) |
|
Working as a Data Scientist |
|
|
294 | (1) |
|
Researching the Next Big Thing |
|
|
295 | (2) |
| Index |
|
297 | |