售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Table of Contents
Professional Scala
Why Subscribe?
PacktPub.com
Contributors
About the Authors
Preface
Who This Book Is For
What This Book Covers
What You Need for This Book
Conventions
Note
Tip
Installation and Setup
Installing IntelliJ IDE
Installing Scala plugin (make heading)
Reader Feedback
Customer Support
Downloading the Example Code
Errata
Piracy
Questions
Chapter 1. Setting up the Development Environment
Note
Simple Program
Definitions: Packages, Imports, and Objects
Object Definition
The main Method
Inside main
Structure of a Scala Project
Note
Note
Basic sbt Commands
Activity: Performing Basic Operations with sbt: Build, Run, Package
IDE
Activity: Loading and Running a Sample Project in the IDE
REPL
Obtaining the Time Request from Our Chatbot Program
Base Syntax
Note
Base Syntax for Definitions
Base Syntax for Expressions
Note
Unit Testing
Adding a Test to Our Project
Inside Tests
Running Tests for Chatbot
Note
Summary
Chapter 2. Basic Language Features
Objects, Classes, and Traits
Object
Note
Classes
Equality and Case Classes
Note
Note
Pattern Matching
Traits
Self-Types
Note
Note
Note
Special Classes
OO in Our Chatbot
Decoupling Logic and Environment
Note
Sealed Traits and Algebraic Datatypes
Note
Note
Function Calls
Syntax Goodies
Named Parameters
Default Parameters
Currying Forms (Multiple Argument Lists)
Special Magic Methods
Implementing + in CartesianPoint
Parameter-Passing Mode
By Value
By Name
By Need
Creating a Runnable Construction
Printing the log Argument to the Console and File
Summary
Chapter 3. Functions
Functions
Function Values
Function from an OO Point of View
Conversions
Defining and Measuring the Time of a Unit Function
Syntax Sugar in a Function Definition
Partial Functions
Exploring Pattern Matching
Binding a Sequence of Variables in the Pattern Matcher
Partial Functions in Practice
Note
Representing ChatbotMode as a Partial Function
Implementing RemindStore as a Set of Partial Functions
Note
Using Lifting for Conversations between Total and Partial Functions
Summary
Chapter 4. Scala Collections
Working with Lists
Constructing Lists
Note
Operations on Lists
Note
Pattern Matching on Lists
First-Order Methods on List
Appending and Concatenation
Taking the Length of a List
Reversing a List
Prefixes and Suffixes
Element Selection
Display
Note
Activity: Creating a New Mode for Chatbot Using Lists
Abstracting on Sequences
The Traversable Trait
Note
Note
Iterators
Streams
Activity: Implementing Fibonacci Series Using Streams and Iterators
Other Collections
Sets
Tuples
Maps
Note
Mutable and Immutable Collections
Activity: Implementing the Tower of Hanoi Problem
Summary
Chapter 5. Scala Type System
Type Basics and Polymorphism
A Unified Type System
Parametric Polymorphism
Type Inference
Parameterized Types
Bounds
Existential Types
Activity: Generalizing the Implementation of the Binary Tree
Note
Variance
Covariance
Contravariance
Invariance
Activity: Implementing Covariance and the Database for Tools
Advanced Types
Abstract Type Members
Structural Types
Option
Higher Kind Types
Type Erasure
Activity: Finding an Element Based on a Given Predicate
Summary
Chapter 6. Implicits
Implicit Parameters and Implicit Conversions
Implicit Parameters
Implicit Conversions
Note
Implicit Resolution
Note
Activity: Creation of Extension Methods
Ad Hoc Polymorphism and Type Classes
Types of Polymorphism
Type Classes
Context Bounds and Implicitly
Type Classes in the Standard Library
Note
Activity: Implementing Type Classes to Support Conversion
Summary
Chapter 7. Functional Idioms
Introduction to Functional Programming Concepts
Pure Functions
Immutability
Implementing the standard library
Higher-Order Functions
Functional Design Patterns
Note
Note
Monoids
Note
Using Monoids to Write Polymorphic Functions
Functor
Note
Note
Monads
Note
Note
Popular Libraries
Validating Data Using Cats
Note
Prerequisites for Using Cats
Introduction to Cats
Validating Data
Validating Using Validated
Communicating with Databases Using Doobie
Prerequisites for Doobie
Doobie
ConnectionIO
Transactor
Selecting Rows
Querying Using Parameters
Note
Deleting, Inserting, and Updating Rows
A Complete Example
Activity: Adding Priority to the Todo List
Summary
Chapter 8. Domain Specific Languages
DSLs and Types of DSLs
External DSLs
Note
Internal DSLs
ScalaTest – A Popular DSL
Note
Adding ScalaTest to Your Project
Note
Overview of ScalaTest Styles
Activity: Implementing ScalaTest Styles
Language Features for Writing DSLs
Flexible Syntax for Method Invocation
By-Name Parameters
Note
Extension Methods and Value Classes
Writing a Small DSL
Modeling Test Cases
DSL for TestCase
Activity: Creating a DSL to Specify Assertions
Note
Beyond This Book
Various Scala Libraries
Akka
Note
Note
Note
Apache Spark
Note
Shapeless
Uncovered Language Features
Macros
Note
Def Macros
Implicit Macros
Quasiquotes
Reflection
Note
Resources to Keep You Updated
Scala Improvement Process
Note
Scala Times
Note
Summary
Index
A
B
C
D
E
F
H
I
L
M
N
O
P
Q
R
S
T
U
V
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜