Table of Contents
Foreword Dr. Viral B. Shah xiii
Preface xv
Acknowledgments xvii
1 Introduction and Setting Up Your Julia Environment 1
Programming and Its Impacts 2
Why Julia? 2
Rationale Behind Learning Julia 4
What Does This Book Aim to Cover? 7
Setting Up to Work with Julia 7
2 Variables and Input 11
What Are Variables? 12
Using Simple Variables in Julia to Store Information 13
Taking, Storing, and Using Input from a User 16
Operators and Syntax 19
Types of Variables 21
Converting Between Variables 25
3 Conditions and Iterations 31
What Is a Condition? 32
What Are Conditional Operators? 32
How Computers Make Decisions Using if/elseif/else Statements 35
Practice 1 38
What Are Iterations? 39
How to Iterate Using/or Loops 39
Exercise 44
How to Iterate Using while Loops 45
4 Arrays and Dictionaries 51
What Are Arrays and Why Are They Required? 52
How to Create, Go Through, and Modify Arrays 52
Some Operations on Arrays 55
What Are Dictionaries and What Are Their Advantages Over Arrays? 67
Creating and Using Dictionaries 68
Building the Lending App Using Dictionaries 71
Some Useful Functions Available in Julia 73
Split() Function 73
Join() Function 74
Collect() Function 75
5 Functions 79
Functions and How to Use Them 80
Functions Help in Reducing Errors and Easy Maintenance of Code 80
Declaring and Calling Functions 82
Functions That Return Values 85
Functions with Optional Keyword Arguments 94
Applying Functions on Arrays 101
Generic Functions 102
Using Functions Recursively 105
6 Handling Errors and Exceptions 109
Bugs and Debugging 110
What Are Errors? 110
What Are Exceptions? 113
Tricks to Find and Eradicate Bugs 116
7 Package Management 119
What Are REST APIs? 121
How to Install and Use Packages 122
Tanmay Teaches 125
Multiprocessing and How It's Used in Julia 126
Calling Code from Other Languages 132
8 Reading and Writing Files 135
Why Are Files Useful? 136
How Do You Read a File in Julia? 136
How Do You Write to Files in Julia? 137
Creating a Caesar Cipher in Julia 138
9 How Machines Learn 145
What Is Machine Learning? 146
How Does Machine Learning Work? 149
Style Transfer Using Flux 150
A Primer on the Calculus Behind Machine Learning 155
Using Flux's Automatic Differentiation to Train a Simple Perceptron 159
10 Next Steps and Resources 163
What to Do to Sharpen Your Skills 164
Resources Available 164
Index 167