Professional Scala
Book information
Description
Scala is a type-safe JVM language that incorporates both object-oriented and functional programming into an extremely concise, logical, and extraordinarily powerful language. Some may be surprised to know that Scala is not quite as new as they may have thought, having first been introduced in 2003. However, it is in the past few years in particular that Scala has begun to develop a significant following. This book enables you to build and contribute to Scala programs, recognizing common patterns and techniques used with the language. This is a practical book which provides you with a lot of hands-on experience with Scala. This book is for developers who are interested in learning about the advanced features of the Scala language. Basic knowledge of the Scala programming language is required to follow the instructions in this book Table of Contents......Page 7 Preface......Page 15 Setting up the Development Environment......Page 21 Object Definition......Page 23 Inside main......Page 24 Structure of a Scala Project......Page 26 Basic sbt Commands......Page 28 IDE......Page 29 REPL......Page 30 Obtaining the Time Request from Our Chatbot Program......Page 31 Base Syntax......Page 32 Base Syntax for Definitions......Page 33 Base Syntax for Expressions......Page 34 Adding a Test to Our Project......Page 36 Inside Tests......Page 38 Running Tests for Chatbot......Page 39 Summary......Page 43 Basic Language Features......Page 45 Object......Page 46 Classes......Page 47 Equality and Case Classes......Page 49 Pattern Matching......Page 51 Traits......Page 52 Self-Types......Page 55 Decoupling Logic and Environment......Page 58 Sealed Traits and Algebraic Datatypes......Page 60 Default Parameters......Page 65 Parameter-Passing Mode......Page 67 By Name......Page 68 Creating a Runnable Construction......Page 69 Printing the log Argument to the Console and File......Page 70 Summary......Page 71 Functions......Page 73 Function Values......Page 74 Function from an OO Point of View......Page 75 Conversions......Page 76 Defining and Measuring the Time of a Unit Function......Page 77 Partial Functions......Page 78 Exploring Pattern Matching......Page 80 Binding a Sequence of Variables in the Pattern Matcher......Page 82 Representing ChatbotMode as a Partial Function......Page 84 Implementing RemindStore as a Set of Partial Functions......Page 86 Using Lifting for Conversations between Total and Partial Functions......Page 87 Summary......Page 90 Scala Collections......Page 91 Constructing Lists......Page 92 Pattern Matching on Lists......Page 93 Appending and Concatenation......Page 94 Element Selection......Page 95 Display......Page 96 Abstracting on Sequences......Page 97 The Traversable Trait......Page 98 Iterators......Page 99 Activity: Implementing Fibonacci Series Using Streams and Iterators......Page 100 Tuples......Page 101 Mutable and Immutable Collections......Page 102 Activity: Implementing the Tower of Hanoi Problem......Page 104 Summary......Page 105 Scala Type System......Page 107 Parametric Polymorphism......Page 108 Type Inference......Page 109 Existential Types......Page 110 Activity: Generalizing the Implementation of the Binary Tree......Page 112 Variance......Page 113 Covariance......Page 114 Invariance......Page 115 Abstract Type Members......Page 117 Structural Types......Page 118 Option......Page 119 Type Erasure......Page 120 Summary......Page 121 Implicits......Page 123 Implicit Parameters......Page 124 Implicit Conversions......Page 125 Implicit Resolution......Page 126 Activity: Creation of Extension Methods......Page 127 Type Classes......Page 128 Context Bounds and Implicitly......Page 129 Type Classes in the Standard Library......Page 130 Summary......Page 131 Functional Idioms......Page 133 Pure Functions......Page 134 Immutability......Page 136 Higher-Order Functions......Page 137 Functional Design Patterns......Page 139 Monoids......Page 140 Functor......Page 142 Monads......Page 144 Prerequisites for Using Cats......Page 146 Validating Data......Page 147 Validating Using Validated......Page 148 Prerequisites for Doobie......Page 150 Transactor......Page 151 Selecting Rows......Page 152 Querying Using Parameters......Page 153 Deleting, Inserting, and Updating Rows......Page 154 A Complete Example......Page 155 Summary......Page 156 Domain Specific Languages......Page 157 External DSLs......Page 158 ScalaTest – A Popular DSL......Page 159 Adding ScalaTest to Your Project......Page 160 Overview of ScalaTest Styles......Page 161 Language Features for Writing DSLs......Page 165 By-Name Parameters......Page 166 Writing a Small DSL......Page 167 Modeling Test Cases......Page 168 DSL for TestCase......Page 169 Activity: Creating a DSL to Specify Assertions......Page 171 Akka......Page 172 Shapeless......Page 173 Macros......Page 174 Implicit Macros......Page 175 Reflection......Page 176 Scala Improvement Process......Page 177 Summary......Page 178 Index......Page 179
Similar books
Professional Scala
2018 · PDF
MySQL® Notes for Professionals book
2018 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF
Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36
2010 · PDF
THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.
1858 · PDF
Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.
2022 · PDF
The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians
1809 · PDF