Muutke küpsiste eelistusi

E-raamat: Think Perl 6: How to Think Like a Computer Scientist

  • Formaat: 466 pages
  • Ilmumisaeg: 08-May-2017
  • Kirjastus: O'Reilly Media
  • Keel: eng
  • ISBN-13: 9781491980521
  • Formaat - PDF+DRM
  • Hind: 40,37 €*
  • * hind on lõplik, st. muud allahindlused enam ei rakendu
  • Lisa ostukorvi
  • Lisa soovinimekirja
  • See e-raamat on mõeldud ainult isiklikuks kasutamiseks. E-raamatuid ei saa tagastada.
  • Formaat: 466 pages
  • Ilmumisaeg: 08-May-2017
  • Kirjastus: O'Reilly Media
  • Keel: eng
  • ISBN-13: 9781491980521

DRM piirangud

  • Kopeerimine (copy/paste):

    ei ole lubatud

  • Printimine:

    ei ole lubatud

  • Kasutamine:

    Digitaalõiguste kaitse (DRM)
    Kirjastus on väljastanud selle e-raamatu krüpteeritud kujul, mis tähendab, et selle lugemiseks peate installeerima spetsiaalse tarkvara. Samuti peate looma endale  Adobe ID Rohkem infot siin. E-raamatut saab lugeda 1 kasutaja ning alla laadida kuni 6'de seadmesse (kõik autoriseeritud sama Adobe ID-ga).

    Vajalik tarkvara
    Mobiilsetes seadmetes (telefon või tahvelarvuti) lugemiseks peate installeerima selle tasuta rakenduse: PocketBook Reader (iOS / Android)

    PC või Mac seadmes lugemiseks peate installima Adobe Digital Editionsi (Seeon tasuta rakendus spetsiaalselt e-raamatute lugemiseks. Seda ei tohi segamini ajada Adober Reader'iga, mis tõenäoliselt on juba teie arvutisse installeeritud )

    Seda e-raamatut ei saa lugeda Amazon Kindle's. 

Want to learn how to program and think like a computer scientist? This practical guide gets you started on your programming journey with the help of Perl 6, the younger sister of the popular Perl programming language. Ideal for beginners, this hands-on book includes over 100 exercises with multiple solutions, and more than 1,000 code examples so you can quickly practice what you learn. Experienced programmers—especially those who know Perl 5—will also benefit.

Divided into two parts, Think Perl 6 starts with basic concepts that every programmer needs to know, and then focuses on different programming paradigms and some more advanced programming techniques. With two semesters’ worth of lessons, this book is the perfect teaching tool for computer science beginners in colleges and universities.

  • Learn basic concepts including variables, expressions, statements, functions, conditionals, recursion, and loops
  • Understand commonly used basic data structures and the most useful algorithms
  • Dive into object-oriented programming, and learn how to construct your own types and methods to extend the language
  • Use grammars and regular expressions to analyze textual content
  • Explore how functional programming can help you make your code simpler and more expressive
Preface xiii
Part I. Starting with the Basics
1 The Way of the Program
3(12)
What Is a Program?
3(1)
Running Pen 6
4(2)
The First Program
6(1)
Arithmetic Operators
6(1)
Values and Types
7(3)
Formal and Natural Languages
10(1)
Debugging
11(1)
Glossary
12(2)
Exercises
14(1)
2 Variables, Expressions, and Statements
15(16)
Assignment Statements
15(2)
Variable Names
17(2)
Expressions and Statements
19(2)
Script Mode
21(1)
One-Liner Mode
22(1)
Order of Operations
23(1)
String Operations
24(1)
Comments
25(1)
Debugging
25(1)
Glossary
26(2)
Exercises
28(3)
3 Functions
31(24)
Function Calls
31(3)
Functions and Methods
34(1)
Math Functions
34(2)
Composition
36(1)
Adding New Functions (a.k.a. Subroutines)
37(2)
Definitions and Uses
39(1)
Flow of Execution
39(1)
Parameters and Arguments
40(1)
Variables and Parameters Are Local
41(1)
Stack Diagrams
42(1)
Fruitful Functions and Void Functions
42(2)
Function Signatures
44(2)
Immutable and Mutable Parameters
46(1)
Functions and Subroutines as First-Class Citizens
47(2)
Why Functions and Subroutines?
49(1)
Debugging
50(1)
Glossary
50(3)
Exercises
53(2)
4 Loops, Conditionals, and Recursion
55(22)
Integer Division and Modulo
55(1)
Boolean expressions
56(2)
Logical Operators
58(2)
Conditional Execution
60(1)
Alternative Execution
61(1)
Chained Conditionals
61(1)
Nested Conditionals
62(1)
if Conditionals as Statement Modifiers
63(1)
Unless Conditional Statement
63(1)
for Loops
64(2)
Recursion
66(1)
Stack Diagrams for Recursive Subroutines
67(1)
Infinite Recursion
68(1)
Keyboard Input
68(1)
Program Arguments and the MAIN Subroutine
69(1)
Debugging
70(1)
Glossary
71(2)
Exercises
73(4)
5 Fruitful Subroutines
77(18)
Return Values
77(2)
Incremental Development
79(2)
Composition
81(1)
Boolean Functions
82(1)
A Complete Programming Language
83(1)
More Recursion
84(2)
Leap of Faith
86(1)
One More Example
87(1)
Checking Types
87(2)
Multi Subroutines
89(1)
Debugging
90(1)
Glossary
91(1)
Exercises
92(3)
6 Iteration
95(14)
Assignment Versus Equality
95(1)
Reassignment
96(1)
Updating Variables
96(1)
The while Statement
97(2)
Local Variables and Variable Scoping
99(3)
Control Flow Statements (last, next, etc.)
102(2)
Square Roots
104(2)
Algorithms
106(1)
Debugging
106(1)
Glossary
107(1)
Exercises
107(2)
7 Strings
109(30)
A String Is a Sequence
109(1)
Common String Operators
110(5)
String Length
110(1)
Searching for a Substring Within the String
111(1)
Extracting a Substring from a String
111(1)
A Few Other Useful String Functions or Methods
112(3)
String Traversal with a while or for Loop
115(1)
Looping and Counting
116(1)
Regular Expressions (Regexes)
116(2)
Using Regexes
118(1)
Building your Regex Patterns
119(8)
Literal Matching
119(1)
Wildcards and Character Classes
120(1)
Quantifiers
121(1)
Anchors and Assertions
122(2)
Alternation
124(1)
Grouping and Capturing
124(1)
Adverbs (a.k.a. Modifiers)
125(1)
Exercises on Regexes
126(1)
Putting It All Together
127(3)
Extracting Dates
127(1)
Extracting an IP Address
128(2)
Substitutions
130(1)
The subst Method
130(1)
The s/search/replace/ Construct
130(1)
Using Captures
131(1)
Adverbs
131(1)
Debugging
131(3)
Glossary
134(1)
Exercises
135(4)
8 Case Study: Word Play
139(14)
Reading from and Writing to Files
139(2)
Reading Word Lists
141(1)
Exercises
142(1)
Search
143(6)
Words Longer Than 20 Characters (Solution)
143(1)
Words with No "e" (Solution)
144(1)
Avoiding Other Letters (Solution)
145(1)
Using Only Some Letters (Solution)
146(1)
Using All Letters of a List (Solution)
147(1)
Alphabetic Order (Solution)
147(1)
Another Example of Reduction to a Previously Solved Problem
148(1)
Debugging
149(1)
Glossary
149(1)
Exercises
150(3)
9 Arrays and Lists
153(30)
Lists and Arrays Are Sequences
153(2)
Arrays Are Mutable
155(3)
Adding New Elements to an Array or Removing Some
158(1)
Stacks and Queues
159(1)
Other Ways to Modify an Array
160(2)
Traversing a List
162(2)
New Looping Constructs
164(1)
Map, Filter, and Reduce
165(5)
Reducing a List to a Value
165(1)
The Reduction Metaoperator
166(1)
Mapping a List to Another List
167(1)
Filtering the Elements of a List
168(1)
Higher-Order Functions and Functional Programming
169(1)
Fixed-Size, Typed, and Shaped Arrays
170(1)
Multidimensional Arrays
171(1)
Sorting Arrays or Lists
172(1)
More Advanced Sorting Techniques
173(3)
Debugging
176(1)
Glossary
177(1)
Exercises
178(5)
10 Hashes
183(20)
A Hash Is a Mapping
183(3)
Common Operations on Hashes
186(1)
Hash as a Collection of Counters
187(1)
Looping and Hashes
188(1)
Reverse Lookup
189(1)
Testing for Existence
190(2)
Hash Keys Are Unique
192(1)
Hashes and Arrays
193(2)
Memos
195(2)
Hashes as Dispatch Tables
197(1)
Global Variables
198(1)
Debugging
199(1)
Glossary
200(1)
Exercises
201(2)
11 Case Study: Data Structure Selection
203(34)
The Ternary Conditional Operator
203(1)
The given...when "Switch" Statement
204(2)
Subroutine Named and Optional Parameters
206(2)
Named Parameters
206(1)
Optional Parameters
207(1)
Word Frequency Analysis
208(1)
Random Numbers
208(2)
Word Histogram
210(2)
Most Common Words
212(1)
Optional Parameters
213(1)
Hash Subtraction
214(1)
Constructing New Operators
214(1)
Sets, Bags, and Mixes
215(2)
Random Words
217(2)
Markov Analysis
219(2)
Data Structures
221(1)
Building Your Own Data Structures
222(5)
Linked Lists
223(1)
Trees
224(1)
Binary Heaps
224(3)
Debugging
227(2)
Glossary
229(1)
Exercises: Huffman Coding
230(7)
Variable-Length Codes
230(1)
The Frequency Table
231(1)
Building the Huffman Code
231(6)
Part II. Moving Forward
12 Classes and Objects
237(36)
Objects, Methods, and Object-Oriented Programming
237(2)
Programmer-Defined Types
239(1)
Attributes
240(2)
Creating Methods
242(3)
Rectangles and Object Composition
245(2)
Instances as Return Values
247(1)
Inheritance
247(5)
The Pixel Class
248(2)
The MovablePoint Class
250(1)
Multiple Inheritance: Attractive, but Is It Wise?
251(1)
Roles and Composition
252(4)
Classes and Roles: An Example
253(2)
Role Composition and Code Reuse
255(1)
Roles, Classes, Objects, and Types
256(1)
Method Delegation
256(2)
Polymorphism
258(1)
Encapsulation
259(5)
Private Methods
260(1)
Constructing Objects with Private Attributes
261(3)
Interface and Implementation
264(1)
Object-Oriented Programming: A Tale
264(2)
The Fable of the Shepherd
265(1)
The Moral
265(1)
Debugging
266(4)
The Perl 6 Debugger
266(1)
Getting Some Help
267(1)
Stepping Through the Code
267(1)
Stopping at the Right Place with Breakpoints
268(1)
Logging Information with Trace Points
268(1)
Stepping Through a Regex Match
269(1)
Glossary
270(3)
13 Regexes and Grammars
273(24)
A Brief Refresher
273(2)
Declarative Programming
275(1)
Captures
275(1)
Named Rules (a.k.a. Subrules)
276(3)
Grammars
279(2)
Grammar Inheritance
281(1)
Actions Objects
282(2)
A Grammar for Parsing JSON
284(7)
The JSON Format
284(1)
Our JSON Sample
284(1)
Writing the JSON Grammar Step by Step
285(2)
The JSON Grammar
287(2)
Adding Actions
289(2)
Inheritance and Mutable Grammars
291(1)
Debugging
291(2)
Glossary
293(1)
Exercise: A Grammar for an Arithmetic Calculator
294(3)
14 Functional Programming in Perl
297(40)
Higher-Order Functions
297(5)
A Refresher on Functions as First-Class Objects
297(2)
Anonymous Subroutines and Lambdas
299(1)
Closures
300(2)
List Processing and Pipeline Programming
302(8)
Feed and Backward Feed Operators
303(1)
The Reduction Metaoperator
304(1)
The Hyperoperator
304(1)
The Cross (X) and Zip (Z) Operators
305(1)
List Operators: A Summary
306(1)
Creating New Operators
307(3)
Creating Your Own Map-Like Functions
310(6)
Custom versions of map, grep, etc.
310(1)
Our Own Version of a Sort Function
311(2)
An Iterator Version of map
313(1)
An Iterator Version of grep
314(2)
The gather and take Construct
316(3)
Lazy Lists and the Sequence Operator
319(3)
The Sequence Operator
319(1)
Infinite Lists
320(1)
Using an Explicit Generator
320(2)
Currying and the Whatever Operator
322(3)
Creating a Curried Subroutine
323(1)
Currying an Existing Subroutine with the assuming Method
323(1)
Currying with the Whatever Star Parameter
324(1)
Using a Functional Programming Style
325(4)
The Merge Sort Algorithm
325(1)
A Nonfunctional Implementation of Merge Sort
326(2)
A Functional Implementation of Merge Sort
328(1)
Debugging
329(4)
Glossary
333(1)
Exercise: Quick Sort
334(3)
15 Some Final Advice
337(8)
Make It Clear, Keep It Simple
337(1)
Dos and Don'ts
338(2)
Use Idioms
340(3)
What's Next?
343(2)
A Solutions to the Exercises 345(82)
Index 427
Laurent Rosenfeld has been a software engineer for about 20 years, working especially as a contractor for one of the largest telecommunication operator in Europe, particularly in the field of mobile networks. Over the last few years, he has been working especially in the fields of data migration, data quality, and data munging. He has written a number of tutorials on Perl 5 and Perl 6.Allen Downey is a Professor of Computer Science at Olin College of Engineering. He has taught at Wellesley College, Colby College and U.C. Berkeley. He has a Ph.D. in Computer Science from U.C. Berkeley and Master's and Bachelor's degrees from MIT.