Scala By Example (Scala qua ví dụ) - Martin Odersky
Giáo trình giới thiệu ngôn ngữ lập trình Scala qua các ví dụ, bao gồm các khái niệm cơ bản và nâng cao như hàm, lớp, danh sách, kiểu generic, xử lý đồng thời.
Vorschau wird generiert...
Scala By Example DRAFT May 24, 2011 Martin Odersky P ROGRAMMING M ETHODS L ABORATORY EPFL S WITZERLAND Contents 1 Introduction 1 2 A First Example 3 3 Programming with Actors and Messages 7 4 Expressions and Simple Functions 11 4.1 Expressions And Simple Functions . . . . . . . . . . . . . . . . . . . . . . 11 4.2 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.3 Conditional Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.4 Example: Square Roots by Newton’s Method . . . . . . . . . . . . . . . . 15 4.5 Nested Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.6 Tail Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 5 First-Class Functions 21 5.1 Anonymous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5.2 Currying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.3 Example: Finding Fixed Points of Functions . . . . . . . . . . . . . . . . 25 5.4 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 5.5 Language Elements Seen So Far . . . . . . . . . . . . . . . . . . . . . . . 28 6 Classes and Objects 31 7 Case Classes and Pattern Matching 43 7.1 Case Classes and Case Objects . . . . . . . . . . . . . . . . . . . . . . . . 46 7.2 Pattern Matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 8 Generic Types and Methods 51 8.1 Type Parameter Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 8.2 Variance Annotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 iv CONTENTS 8.3 Lower Bounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 8.4 Least Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 8.5 Tuples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 8.6 Functions . . . . . . . . . . . . . . . . . .
… Laden Sie die Originaldatei herunter, um das vollständige Dokument zu lesen.
- Dokumentenname
- Scala By Example (Scala qua ví dụ) - Martin Odersky
- Autor (im Dokument)
- Martin Odersky
- Inhalt
- Tài liệu 'Scala By Example' là một bản nháp giới thiệu ngôn ngữ lập trình Scala thông qua các ví dụ thực tế. Nó bao gồm các chủ đề từ cơ bản như biểu thức và hàm đến các khái niệm nâng cao như Actors, kiểu dữ liệu chung và tính đồng thời.
- Inhaltsverzeichnis
- 4.1 Expressions And Simple Functions
- 4.2 Parameters
- 4.3 Conditional Expressions
- 4.4 Example: Square Roots by Newton’s Method
- 4.5 Nested Functions
- 4.6 Tail Recursion
- 5.1 Anonymous Functions
- 5.2 Currying
- 5.3 Example: Finding Fixed Points of Functions
- 5.4 Summary
- 5.5 Language Elements Seen So Far
- 7.1 Case Classes and Case Objects
- 7.2 Pattern Matching
- 8.1 Type Parameter Bounds
- 8.2 Variance Annotations
- 8.3 Lower Bounds
- 8.4 Least Types
- 8.5 Tuples
- 8.6 Functions
- 9.1 Using Lists
- 9.2 Definition of class List I: First Order Methods
- 9.3 Example: Merge sort
- 9.4 Definition of class List II: Higher-Order Methods
- 9.5 Summary
- 10.1 The N-Queens Problem
- 10.2 Querying with For-Comprehensions
- 10.3 Translation of For-Comprehensions
- 10.4 For-Loops
- 10.5 Generalizing For
- 11.1 Stateful Objects
- 11.2 Imperative Control Structures
- 11.3 Extended Example: Discrete Event Simulation
- 11.4 Summary
- 13.1 Iterator Methods
- 13.2 Constructing Iterators
- 13.3 Using Iterators
- 17.1 Signals and Monitors
- 17.2 SyncVars
- 17.3 Futures
- 17.4 Parallel Computations
- 17.5 Semaphores
- 17.6 Readers/Writers
- 17.7 Asynchronous Channels
- 17.8 Synchronous Channels
- 17.9 Workers
- 17.10Mailboxes
- 17.11Actors
- Chapter
- Seiten
- 145 Seiten
- Hochgeladen von
- lienhejb
Häufig gestellte Fragen
Ist dieses Dokument kostenlos?
Ja. „Scala By Example (Scala qua ví dụ) - Martin Odersky“ ist kostenlos — melden Sie sich einfach an und klicken Sie auf Herunterladen, um die Originaldatei zu erhalten.
Wie viele Seiten hat dieses Dokument?
Das Dokument hat 145 Seiten. Sie können es vor dem Herunterladen online in der Vorschau ansehen.
Kann ich vor dem Herunterladen eine Vorschau ansehen?
Ja. Sie können sich dieses Dokument direkt auf dieser Seite im Online-Reader ansehen und dann entscheiden, ob Sie es herunterladen möchten.

Kommentare (0)
Noch keine Kommentare. Seien Sie der Erste!