ENGLISH

Think Julia: How to Think Like a Computer Scientist

Book information

Publisher
O'Reilly Media
Year
2019
ISBN
9781492044987
Language
english
Format
PDF
Filesize
10 MB (10488516 bytes)
Edition
1
Pages
298\298
Time added
2020-09-06 11:04:49

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 Cover Copyright Table of Contents Preface Why Julia? Who Is This Book For? Conventions Used in This Book Using Code Examples O’Reilly Online Learning How to Contact Us Acknowledgments Contributor List Chapter 1. The Way of the Program What Is a Program? Running Julia The First Program Arithmetic Operators Values and Types Formal and Natural Languages Debugging Glossary Exercises Chapter 2. Variables, Expressions, and Statements Assignment Statements Variable Names Expressions and Statements Script Mode Operator Precedence String Operations Comments Debugging Glossary Exercises Chapter 3. Functions Function Calls Math Functions Composition Adding New Functions Definitions and Uses Flow of Execution Parameters and Arguments Variables and Parameters Are Local Stack Diagrams Fruitful Functions and Void Functions Why Functions? Debugging Glossary Exercises Chapter 4. Case Study: Interface Design Turtles Simple Repetition Exercises Encapsulation Generalization Interface Design Refactoring A Development Plan Docstring Debugging Glossary Exercises Chapter 5. Conditionals and Recursion Floor Division and Modulus Boolean Expressions Logical Operators Conditional Execution Alternative Execution Chained Conditionals Nested Conditionals Recursion Stack Diagrams for Recursive Functions Infinite Recursion Keyboard Input Debugging Glossary Exercises Chapter 6. Fruitful Functions Return Values Incremental Development Composition Boolean Functions More Recursion Leap of Faith One More Example Checking Types Debugging Glossary Exercises Chapter 7. Iteration Reassignment Updating Variables The while Statement break continue Square Roots Algorithms Debugging Glossary Exercises Chapter 8. Strings Characters A String Is a Sequence length Traversal String Slices Strings Are Immutable String Interpolation Searching Looping and Counting String Library The ∈ Operator String Comparison Debugging Glossary Exercises Chapter 9. Case Study: Word Play Reading Word Lists Exercises Search Looping with Indices Debugging Glossary Exercises Chapter 10. Arrays An Array Is a Sequence Arrays Are Mutable Traversing an Array Array Slices Array Library Map, Filter, and Reduce Dot Syntax Deleting (Inserting) Elements Arrays and Strings Objects and Values Aliasing Array Arguments Debugging Glossary Exercises Chapter 11. Dictionaries A Dictionary Is a Mapping Dictionaries as Collections of Counters Looping and Dictionaries Reverse Lookup Dictionaries and Arrays Memos Global Variables Debugging Glossary Exercises Chapter 12. Tuples Tuples Are Immutable Tuple Assignment Tuples as Return Values Variable-Length Argument Tuples Arrays and Tuples Dictionaries and Tuples Sequences of Sequences Debugging Glossary Exercises Chapter 13. Case Study: Data Structure Selection Word Frequency Analysis Random Numbers Word Histogram Most Common Words Optional Parameters Dictionary Subtraction Random Words Markov Analysis Data Structures Debugging Glossary Exercises Chapter 14. Files Persistence Reading and Writing Formatting Filenames and Paths Catching Exceptions Databases Serialization Command Objects Modules Debugging Glossary Exercises Chapter 15. Structs and Objects Composite Types Structs Are Immutable Mutable Structs Rectangles Instances as Arguments Instances as Return Values Copying Debugging Glossary Exercises Chapter 16. Structs and Functions Time Pure Functions Modifiers Prototyping Versus Planning Debugging Glossary Exercises Chapter 17. Multiple Dispatch Type Declarations Methods Additional Examples Constructors show Operator Overloading Multiple Dispatch Generic Programming Interface and Implementation Debugging Glossary Exercises Chapter 18. Subtyping Cards Global Variables Comparing Cards Unit Testing Decks Add, Remove, Shuffle, and Sort Abstract Types and Subtyping Abstract Types and Functions Type Diagrams Debugging Data Encapsulation Glossary Exercises Chapter 19. The Goodies: Syntax Named Tuples Functions Anonymous Functions Keyword Arguments Closures Blocks let Blocks do Blocks Control Flow Ternary Operator Short-Circuit Evaluation Tasks (aka Coroutines) Types Primitive Types Parametric Types Type Unions Methods Parametric Methods Function-like Objects Constructors Conversion and Promotion Conversion Promotion Metaprogramming Expressions eval Macros Generated Functions Missing Values Calling C and Fortran Code Glossary Chapter 20. The Goodies: Base and Standard Library Measuring Performance Collections and Data Structures Mathematics Strings Arrays Interfaces Interactive Utilities Debugging Glossary Chapter 21. Debugging Syntax Errors I Keep Making Changes and It Makes No Difference Runtime Errors My Program Does Absolutely Nothing My Program Hangs When I Run the Program I Get an Exception I Added So Many print Statements I Get Inundated with Output Semantic Errors My Program Doesn’t Work I’ve Got a Big Hairy Expression and It Doesn’t Do What I Expect I’ve Got a Function That Doesn’t Return What I Expect I’m Really, Really Stuck and I Need Help No, I Really Need Help Appendix A. Unicode Input Appendix B. JuliaBox Index About the Authors Colophon

Similar books