ENGLISH

Racket Programming the Fun Way: From Strings to Turing Machines

Book information

Publisher
No Starch Press
Year
2020
ISBN
9781718500822, 9781718500839, 2020022884, 2020022885
Language
english
Format
PDF
Filesize
17 MB (18013715 bytes)
Pages
\364
Time added
2022-07-28 23:33:05

Description

At last, a lively guided tour through all the features, functions, and applications of the Racket programming language. You’ll learn a variety of coding paradigms, including iterative, object oriented, and logic programming; create interactive graphics, draw diagrams, and solve puzzles as you explore Racket through fun computer science topics—from statistical analysis to search algorithms, the Turing machine, and more. Early chapters cover basic Racket concepts like data types, syntax, variables, strings, and formatted output. You’ll learn how to perform math in Racket’s rich numerical environment, and use programming constructs in different problem domains (like coding solutions to the Tower of Hanoi puzzle). Later, you’ll play with plotting, grapple with graphics, and visualize data. Then, you’ll escape the confines of the command line to produce animations, interactive games, and a card trick program that’ll dazzle your friends. You'll learn how to: Use DrRacket, an interactive development environment (IDE) for writing programs Compute classical math problems, like the Fibonacci sequence Generate two-dimensional function plots and create drawings using graphics primitives Import and export data to and from Racket using ports, then visually analyze it Build simple computing devices (pushdown automaton, Turing machine, and so on) that perform tasks Leverage Racket’s built-in libraries to develop a command line algebraic calculator Racket Programming the Fun Way is just like the language itself—an embodiment of everything that makes programming interesting and worthwhile, and that makes you a better programmer. Brief Contents Contents in Detail Acknowledgments Introduction Racket Conventions Used in This Book Who This Book Is For About This Book Chapter 1: Racket Basics Atomic Data Lists A First Look at Lists S-Expressions List Structure A Few Useful List Functions Defines, Assigns, and Variables Symbols, Identifiers, and Keywords Equality Strings and Things Characters Useful String Functions String Conversion and Formatting Functions Vectors Accessing Vector Elements Useful Vector Functions Using structs Controlling Output Summary Chapter 2: Arithmetic and Other Numerical Paraphernalia Booleans The Numerical Tower Integers Rationals Reals Complex Numbers Numeric Comparison Combining Data Types Built-in Functions Infix Notation Summary Chapter 3: Function Fundamentals What Is a Function? Lambda Functions Higher-Order Functions Lexical Scoping Conditional Expressions: It's All About Choices I'm Feeling a Bit Loopy! Purity The Power of the Dark Side The for Family Time for Some Closure Applications I Don't Have a Queue The Tower of Hanoi Fibonacci and Friends The Insurance Salesman Problem Summary Chapter 4: Plotting, Drawing, and a Bit of Set Theory Plotting X-Y Plots Parametric Plots Getting to the Point Polar Plots Drawing Set Theory The Basics A Short Mathematical Detour Drawing Conclusions Are We Related? Applications Fibonacci Revisited Nim Summary Chapter 5: GUI: Getting Users Interested Introduction to GUIs Animating a Cycloid Pick a Card GUI Layout Building the Controls Control Logic Linear Algebra Zone Wrapping Up the GUI Control Tower Setting Up Row 1 Widgets Row 2 Widgets Getting in Position Controlling the Animation Wrapping Things Up Summary Chapter 6: Data I/O, I/O, It's Off to Work We Go File I/O Ports String Ports Computer-to-Computer Ports Introduction to Security Getting Data into Racket A Database Detour Data Visualization Plotting for Success Lumping Things Together A Bit of Statistics Standard Deviation Regression Summary Chapter 7: Searching for Answers Graph Theory The Basics Graph Search The N-Queens Problem A Racket Solution Dijkstra's Shortest Path Algorithm The Priority Queue The Implementation The 15 Puzzle The A* Search Algorithm The 8-Puzzle in Racket Moving Up to the 15 Puzzle Sudoku Summary Chapter 8: Logic Programming Introduction The Basics Knowing Your Relatives Racklog Predicates Racklog Utilities Applications SEND + MORE = MONEY Fox, Goose, Beans How Many Donuts? Boles and Creots Summary Chapter 9: Computing Machines Finite-State Automata The Turing Machine A Racket Turing Machine Pushdown Automata Recognizing Zeros and Ones More Zeros and Ones A Racket PDA More Automata Fun A Few Words About Languages Summary Chapter 10: TRAC: The Racket Algebraic Calculator The TRAC Pipeline The Lexical Analyzer Regular Expressions Regular Expressions in Racket Regular Expressions in TRAC The Lexer The Parser TRAC Grammar Specification The TRAC Parser TRAC Adding a Dictionary A Few Enhancements Making Sure TRAC Works Properly Making an Executable Summary Appendix A: Number Basics Appendix B: Special Symbols Bibliography Index

Similar books