Scala By Example

Scala smoothly integrates object-oriented and functional programming. It is designed to express common programming patterns in a concise, elegant, and typesafe way. Scala introduces several innovative language constructs. For instance:At the same time, Scala is compatible with Java. Java libraries and frameworks can be used without glue code or additional declarations. This document introduces Scala in an informal way, through a sequence of examples. | Scala By Example DRAFT May 24 2011 Martin Odersky Programming Methods Laboratory EPFL Switzerland Contents 1 Introduction 1 2 A First Example 3 3 Programming with Actors and Messages 7 4 Expressions and Simple Functions 11 Expressions And Simple Functions. 11 Parameters. 12 Conditional Expressions. 15 Example Square Roots by Newton s Method. 15 Nested Functions. 16 Tail Recursion. 18 5 First-Class Functions 21 Anonymous Functions . 22 Currying . 23 Example Finding Fixed Points of Language Elements Seen So Far . 28 6 Classes and Objects 31 7 Case Classes and Pattern Matching 43 Case Classes and Case Objects . 46 Pattern Matching . 47 8 Generic Types and Methods 51 Type Parameter Bounds . 53 Variance Annotations . .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
19    248    1    26-04-2024
13    346    1    26-04-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.