Think Julia

Book description

If you’re just learning how to program, Julia is an excellent JIT-compiled, dynamically typed language with a clean syntax. This hands-on guide uses Julia 1.0 to walk you through programming one step at a time, beginning with basic programming concepts before moving on to more advanced capabilities, such as creating new types and multiple dispatch.

Designed from the beginning for high performance, Julia is a general-purpose language ideal for not only numerical analysis and computational science but also web programming and scripting. Through exercises in each chapter, you’ll try out programming concepts as you learn them. Think Julia is perfect for students at the high school or college level as well as self-learners and professionals who need to learn programming basics.

  • Start with the basics, including language syntax and semantics
  • Get a clear definition of each programming concept
  • Learn about values, variables, statements, functions, and data structures in a logical progression
  • Discover how to work with files and databases
  • Understand types, methods, and multiple dispatch
  • Use debugging techniques to fix syntax, runtime, and semantic errors
  • Explore interface design and data structures through case studies

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Why Julia?
    2. Who Is This Book For?
    3. Conventions Used in This Book
    4. Using Code Examples
    5. O’Reilly Online Learning
      1. How to Contact Us
    6. Acknowledgments
      1. Contributor List
  2. 1. The Way of the Program
    1. What Is a Program?
    2. Running Julia
    3. The First Program
    4. Arithmetic Operators
    5. Values and Types
    6. Formal and Natural Languages
    7. Debugging
    8. Glossary
    9. Exercises
  3. 2. Variables, Expressions, and Statements
    1. Assignment Statements
    2. Variable Names
    3. Expressions and Statements
    4. Script Mode
    5. Operator Precedence
    6. String Operations
    7. Comments
    8. Debugging
    9. Glossary
    10. Exercises
  4. 3. Functions
    1. Function Calls
    2. Math Functions
    3. Composition
    4. Adding New Functions
    5. Definitions and Uses
    6. Flow of Execution
    7. Parameters and Arguments
    8. Variables and Parameters Are Local
    9. Stack Diagrams
    10. Fruitful Functions and Void Functions
    11. Why Functions?
    12. Debugging
    13. Glossary
    14. Exercises
  5. 4. Case Study: Interface Design
    1. Turtles
    2. Simple Repetition
    3. Exercises
    4. Encapsulation
    5. Generalization
    6. Interface Design
    7. Refactoring
    8. A Development Plan
    9. Docstring
    10. Debugging
    11. Glossary
    12. Exercises
  6. 5. Conditionals and Recursion
    1. Floor Division and Modulus
    2. Boolean Expressions
    3. Logical Operators
    4. Conditional Execution
    5. Alternative Execution
    6. Chained Conditionals
    7. Nested Conditionals
    8. Recursion
    9. Stack Diagrams for Recursive Functions
    10. Infinite Recursion
    11. Keyboard Input
    12. Debugging
    13. Glossary
    14. Exercises
  7. 6. Fruitful Functions
    1. Return Values
    2. Incremental Development
    3. Composition
    4. Boolean Functions
    5. More Recursion
    6. Leap of Faith
    7. One More Example
    8. Checking Types
    9. Debugging
    10. Glossary
    11. Exercises
  8. 7. Iteration
    1. Reassignment
    2. Updating Variables
    3. The while Statement
    4. break
    5. continue
    6. Square Roots
    7. Algorithms
    8. Debugging
    9. Glossary
    10. Exercises
  9. 8. Strings
    1. Characters
    2. A String Is a Sequence
    3. length
    4. Traversal
    5. String Slices
    6. Strings Are Immutable
    7. String Interpolation
    8. Searching
    9. Looping and Counting
    10. String Library
    11. The ∈ Operator
    12. String Comparison
    13. Debugging
    14. Glossary
    15. Exercises
  10. 9. Case Study: Word Play
    1. Reading Word Lists
    2. Exercises
    3. Search
    4. Looping with Indices
    5. Debugging
    6. Glossary
    7. Exercises
  11. 10. Arrays
    1. An Array Is a Sequence
    2. Arrays Are Mutable
    3. Traversing an Array
    4. Array Slices
    5. Array Library
    6. Map, Filter, and Reduce
    7. Dot Syntax
    8. Deleting (Inserting) Elements
    9. Arrays and Strings
    10. Objects and Values
    11. Aliasing
    12. Array Arguments
    13. Debugging
    14. Glossary
    15. Exercises
  12. 11. Dictionaries
    1. A Dictionary Is a Mapping
    2. Dictionaries as Collections of Counters
    3. Looping and Dictionaries
    4. Reverse Lookup
    5. Dictionaries and Arrays
    6. Memos
    7. Global Variables
    8. Debugging
    9. Glossary
    10. Exercises
  13. 12. Tuples
    1. Tuples Are Immutable
    2. Tuple Assignment
    3. Tuples as Return Values
    4. Variable-Length Argument Tuples
    5. Arrays and Tuples
    6. Dictionaries and Tuples
    7. Sequences of Sequences
    8. Debugging
    9. Glossary
    10. Exercises
  14. 13. Case Study: Data Structure Selection
    1. Word Frequency Analysis
    2. Random Numbers
    3. Word Histogram
    4. Most Common Words
    5. Optional Parameters
    6. Dictionary Subtraction
    7. Random Words
    8. Markov Analysis
    9. Data Structures
    10. Debugging
    11. Glossary
    12. Exercises
  15. 14. Files
    1. Persistence
    2. Reading and Writing
    3. Formatting
    4. Filenames and Paths
    5. Catching Exceptions
    6. Databases
    7. Serialization
    8. Command Objects
    9. Modules
    10. Debugging
    11. Glossary
    12. Exercises
  16. 15. Structs and Objects
    1. Composite Types
    2. Structs Are Immutable
    3. Mutable Structs
    4. Rectangles
    5. Instances as Arguments
    6. Instances as Return Values
    7. Copying
    8. Debugging
    9. Glossary
    10. Exercises
  17. 16. Structs and Functions
    1. Time
    2. Pure Functions
    3. Modifiers
    4. Prototyping Versus Planning
    5. Debugging
    6. Glossary
    7. Exercises
  18. 17. Multiple Dispatch
    1. Type Declarations
    2. Methods
    3. Additional Examples
    4. Constructors
    5. show
    6. Operator Overloading
    7. Multiple Dispatch
    8. Generic Programming
    9. Interface and Implementation
    10. Debugging
    11. Glossary
    12. Exercises
  19. 18. Subtyping
    1. Cards
    2. Global Variables
    3. Comparing Cards
    4. Unit Testing
    5. Decks
    6. Add, Remove, Shuffle, and Sort
    7. Abstract Types and Subtyping
    8. Abstract Types and Functions
    9. Type Diagrams
    10. Debugging
    11. Data Encapsulation
    12. Glossary
    13. Exercises
  20. 19. The Goodies: Syntax
    1. Named Tuples
    2. Functions
    3. Blocks
    4. Control Flow
    5. Types
    6. Methods
    7. Constructors
    8. Conversion and Promotion
    9. Metaprogramming
    10. Missing Values
    11. Calling C and Fortran Code
    12. Glossary
  21. 20. The Goodies: Base and Standard Library
    1. Measuring Performance
    2. Collections and Data Structures
    3. Mathematics
    4. Strings
    5. Arrays
    6. Interfaces
    7. Interactive Utilities
    8. Debugging
    9. Glossary
  22. 21. Debugging
    1. Syntax Errors
    2. Runtime Errors
    3. Semantic Errors
  23. A. Unicode Input
  24. B. JuliaBox
  25. Index

Product information

  • Title: Think Julia
  • Author(s): Ben Lauwens, Allen B. Downey
  • Release date: April 2019
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781492045038