Scala By Example (Scala qua ví dụ) - Martin Odersky
Generating preview...
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.
Description
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 . . . . . . . . . . . . . . . . . .
AI summary
- Document name
- Scala By Example (Scala qua ví dụ) - Martin Odersky
- Author (in document)
- Martin Odersky
- Content
- 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 of contents
- 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
- Uploaded by
- lienhejb
Frequently asked questions
Is this document free?
Yes. “Scala By Example (Scala qua ví dụ) - Martin Odersky” is free — just sign in and click Download to get the original file.
How many pages is this document?
The document has 145 pages. You can preview it online before downloading.
Can I preview before downloading?
Yes. You can preview this document right on this page with the online reader, then decide whether to download.
Scala By Example (Scala qua ví dụ) - Martin Odersky
Generating preview...
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 . . . . . . . . . . . . . . . . . .
Read full document
- Document name
- Scala By Example (Scala qua ví dụ) - Martin Odersky
- Author (in document)
- Martin Odersky
- Content
- 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 of contents
- 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
- Uploaded by
- lienhejb
Comments (0)
No comments yet. Be the first!
Ngân hàng đề thi môn: Hệ thống thông tin quản lý
Đề thi môn Cơ sở dữ liệu (kèm Đáp án) - Đại học Sư phạm kỹ thuật
Đề thi và đáp án môn Hệ thống thông tin kế toán
Đề thi và đáp án môn Cấu trúc dữ liệu giải thuật
Đáp án đề thi môn Mạng máy tính - ĐH Công nghệ thông tin (CNTT)
K5 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
K2 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
K3 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
K4 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
K1 Bộ đề luyện thi Trạng Nguyên Tiếng Việt (NXB DHQG)
Comments (0)
No comments yet. Be the first!