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.
Génération de l'aperçu...
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 . . . . . . . . . . . . . . . . . .
… Tải file gốc để đọc toàn bộ tài liệu.
- Nom du document
- Scala By Example (Scala qua ví dụ) - Martin Odersky
- Auteur (dans le document)
- Martin Odersky
- Contenu
- 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.
- Table des matières
- 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
- Pages
- 145 pages
- Téléversé par
- lienhejb
Foire aux questions
Tài liệu này có miễn phí không?
Có. “Scala By Example (Scala qua ví dụ) - Martin Odersky” miễn phí — bạn chỉ cần đăng nhập rồi bấm Tải xuống để lấy file gốc.
Tài liệu dài bao nhiêu trang?
Tài liệu gồm 145 trang. Bạn có thể xem trước online trước khi tải.
Tôi có thể xem trước trước khi tải không?
Có. Bạn xem trước tài liệu ngay trên trang này bằng trình đọc online, rồi quyết định tải về.

Commentaires (0)
Aucun commentaire pour le moment. Soyez le premier !