Book description
Scala 3--A Clear, Concise Guide
Scala 3 is concise, consistent, flexible, robust, and efficient, but there's a lot to learn and navigating features and improvements can be challenging. Scala for the Impatient, Third Edition, is a complete yet concise guide that reflects the major enhancements of Scala 3, from improved syntax and revamped type system to powerful contextual abstractions.
This indispensable tutorial offers a faster, easier pathway for learning today's Scala. Horstmann--author of the programming classic, Core Java--covers everything working developers need to know, focusing on hands-on solutions, not academic theory. Given the size and scope of Scala 3, there's plenty to cover but it's presented in small chunks organized for quick access and easy understanding, with plenty of practical insights and focused sample code.
Get started quickly with Scala 3 interpreter, syntax, tools, and current usage
Master core language features: functions, arrays, maps, tuples, packages, imports, exception handling, and more
Design and build better object-oriented code with Scala 3
Use Scala for real-world programming tasks: working with files, regular expressions, and processes
Work with higher-order functions and the powerful Scala collections library
Create concurrent programs with Scala futures
Understand the Scala type system, including revamped enums, intersection and union types, and enhanced type inference
Use contextual abstractions to easily extend class hierarchies, enrich existing classes, perform automatic conversions, and elegantly hide tedious details
Apply advanced "power tools" such as annotations and given values
Discover how to "program with types," analyzing and generating types at compile time
Get a taste of what's now possible with Scala macros
If you're a Java, Python, C++, or C# programmer who's new to Scala or functional programming--or even if you've already used earlier versions of Scala--this guide will help you write code that's more robust, more efficient, and more secure.
Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.
Table of contents
- Cover Page
- About This eBook
- Halftitle Page
- Title Page
- Copyright Page
- Pearson’s Commitment to Diversity, Equity, and Inclusion
- Dedication Page
- Contents
- Foreword to the First Edition
- Preface
- About the Author
- Chapter 1. The Basics
-
Chapter 2. Control Structures and Functions
- 2.1 Conditional Expressions
- 2.2 Statement Termination
- 2.3 Block Expressions and Assignments
- 2.4 Input and Output
- 2.5 Loops
- 2.6 More about the for Loop
- 2.7 Functions
- 2.8 Default and Named Arguments
- 2.9 Variable Arguments
- 2.10 The Main Function
- 2.11 Functions without Parameters
- 2.12 Lazy Values
- 2.13 Exceptions
- Exercises
- Chapter 3. Working with Arrays
- Chapter 4. Maps, Options, and Tuples
- Chapter 5. Classes
- Chapter 6. Objects and Enumerations
- Chapter 7. Packages, Imports, and Exports
-
Chapter 8. Inheritance
- 8.1 Extending a Class
- 8.2 Overriding Methods
- 8.3 Type Checks and Casts
- 8.4 Superclass Construction
- 8.5 Anonymous Subclasses
- 8.6 Abstract Classes
- 8.7 Abstract Fields
- 8.8 Overriding Fields
- 8.9 Open and Sealed Classes
- 8.10 Protected Fields and Methods
- 8.11 Construction Order
- 8.12 The Scala Inheritance Hierarchy
- 8.13 Object Equality
- 8.14 Multiversal Equality
- 8.15 Value Classes
- Exercises
- Chapter 9. Files and Regular Expressions
-
Chapter 10. Traits
- 10.1 Why No Multiple Inheritance?
- 10.2 Traits as Interfaces
- 10.3 Traits with Concrete Methods
- 10.4 Traits for Rich Interfaces
- 10.5 Objects with Traits
- 10.6 Layered Traits
- 10.7 Overriding Abstract Methods in Traits
- 10.8 Concrete Fields in Traits
- 10.9 Abstract Fields in Traits
- 10.10 Trait Construction Order
- 10.11 Trait Constructors with Parameters
- 10.12 Traits Extending Classes
- 10.13 What Happens under the Hood
- 10.14 Transparent Traits
- 10.15 Self Types
- Exercises
-
Chapter 11. Operators
- 11.1 Identifiers
- 11.2 Infix Operators
- 11.3 Unary Operators
- 11.4 Assignment Operators
- 11.5 Precedence
- 11.6 Associativity
- 11.7 The apply and update Methods
- 11.8 The unapply Method
- 11.9 The unapplySeq Method
- 11.10 Alternative Forms of the unapply and unapplySeq Methods
- 11.11 Dynamic Invocation
- 11.12 Typesafe Selection and Application
- Exercises
-
Chapter 12. Higher-Order Functions
- 12.1 Functions as Values
- 12.2 Anonymous Functions
- 12.3 Parameters That Are Functions
- 12.4 Parameter Inference
- 12.5 Useful Higher-Order Functions
- 12.6 Closures
- 12.7 Interoperability with Lambda Expressions
- 12.8 Currying
- 12.9 Methods for Composing, Currying, and Tupling
- 12.10 Control Abstractions
- 12.11 Nonlocal Returns
- Exercises
-
Chapter 13. Collections
- 13.1 The Main Collections Traits
- 13.2 Mutable and Immutable Collections
- 13.3 Sequences
- 13.4 Lists
- 13.5 Sets
- 13.6 Operators for Adding or Removing Elements
- 13.7 Common Methods
- 13.8 Mapping a Function
- 13.9 Reducing, Folding, and Scanning
- 13.10 Zipping
- 13.11 Iterators
- 13.12 Lazy Lists
- 13.13 Interoperability with Java Collections
- Exercises
-
Chapter 14. Pattern Matching
- 14.1 A Better Switch
- 14.2 Guards
- 14.3 Variables in Patterns
- 14.4 Type Patterns
- 14.5 The Matchable Trait
- 14.6 Matching Arrays, Lists, and Tuples
- 14.7 Extractors
- 14.8 Patterns in Variable Declarations
- 14.9 Patterns in for Expressions
- 14.10 Case Classes
- 14.11 Matching Nested Structures
- 14.12 Sealed Classes
- 14.13 Parameterized Enumerations
- 14.14 Partial Functions
- 14.15 Infix Notation in case Clauses
- Exercises
- Chapter 15. Annotations
- Chapter 16. Futures
-
Chapter 17. Type Parameters
- 17.1 Generic Classes
- 17.2 Generic Functions
- 17.3 Bounds for Type Variables
- 17.4 Context Bounds
- 17.5 The ClassTag Context Bound
- 17.6 Multiple Bounds
- 17.7 Type Constraints
- 17.8 Variance
- 17.9 Co- and Contravariant Positions
- 17.10 Objects Can’t Be Generic
- 17.11 Wildcards
- 17.12 Polymorphic Functions
- Exercises
- Chapter 18. Advanced Types
-
Chapter 19. Contextual Abstractions
- 19.1 Context Parameters
- 19.2 More about Context Parameters
- 19.3 Declaring Given Instances
- 19.4 Givens in for and match Expressions
- 19.5 Importing Givens
- 19.6 Extension Methods
- 19.7 Where Extension Methods Are Found
- 19.8 Implicit Conversions
- 19.9 Rules for Implicit Conversions
- 19.10 Importing Implicit Conversions
- 19.11 Context Functions
- 19.12 Evidence
- 19.13 The @implicitNotFound Annotation
- Exercises
- Chapter 20. Type-Level Programming
- Index
- Code Snippets
Product information
- Title: Scala for the Impatient, 3rd Edition
- Author(s):
- Release date: December 2022
- Publisher(s): Addison-Wesley Professional
- ISBN: 9780138033613
You might also like
book
Programming Scala, 3rd Edition
Get up to speed on Scala--the JVM, JavaScript, and natively compiled language that offers all the …
book
Scala Cookbook, 2nd Edition
Save time and trouble building object-oriented, functional, and concurrent applications with Scala. The latest edition of …
book
Functional Programming in Scala, Second Edition
This international bestseller has been revised with new exercises, annotations, and full coverage of Scala 3. …
book
Data Engineering with Scala and Spark
Take your data engineering skills to the next level by learning how to utilize Scala and …