By Vicenç Torra

This booklet provides an advent to the programming language Scala. It offers it from a practical programming viewpoint. The publication explains with element useful programming and recursivity, and comprises chapters on lazy and keen evaluate, streams, higher-order features (including map, fold, decrease, and aggregate), and algebraic info varieties. The booklet additionally describes the object-oriented points of Scala, as they're a basic a part of the language. additionally, the e-book encompasses a bankruptcy on parallelism in Scala, giving an outline of the actor model.

Show description

Read Online or Download Scala: From a Functional Programming Perspective: An Introduction to the Programming Language PDF

Best compilers books

The Definitive Guide to SugarCRM: Better Business Applications (Books for Professionals by Professionals)

SugarCRM is one in every of if no longer the prime Open resource CRM answer on the market at five. five million downloads and transforming into and with approximately 17,000 registered builders and many extra clients. this can be the respectable, definitive ebook written via SugarCRM and recommended through SugarCRM. additionally, this booklet will be additionally the one SugarCRM developer booklet so one can deal with the platform comparable positive aspects in view that SugarCRM five.

Methodologies and Software Engineering for Agent Systems: The Agent-Oriented Software Engineering Handbook

As info applied sciences turn into more and more dispensed and obtainable to greater variety of humans and as advertisement and govt corporations are challenged to scale their functions and companies to bigger marketplace stocks, whereas decreasing expenditures, there's call for for software program methodologies and appli- tions to supply the subsequent positive factors: Richer software end-to-end performance; aid of human involvement within the layout and deployment of the software program; Flexibility of software program behaviour; and Reuse and composition of present software program purposes and structures in novel or adaptive methods.

Numeric Computation and Statistical Data Analysis on the Java Platform

Numerical computation, wisdom discovery and statistical facts research built-in with robust second and 3D pix for visualisation are the major issues of this e-book. The Python code examples powered through the Java platform can simply be remodeled to different programming languages, similar to Java, Groovy, Ruby and BeanShell.

Additional resources for Scala: From a Functional Programming Perspective: An Introduction to the Programming Language

Sample text

F ( f ( f (x1 , x2 ), x3 ), x4 . . , xn ). For example, we can compute the factorial of 10 as follows. reduceLeft((a,b)=>a*b) • reduceRight. This is also similar to foldRight without e0 . 36 2 The Basics of the Language Scala permits to use wildcards in the anonymous function we pass to these higherorder functions. = 0, and (a,b)=>a+b by _+_. Note that in the first case we replace one variable, and in the second case two. The following expressions are valid in Scala and are equivalent to two expressions above.

The expression of the total accumulated value when the initial amount was P (the principal sum) and the total is to be computed for t years at a i nominal interest rate compounded annually is the following: 20 2 The Basics of the Language P(1 + i)t We can write this function in Scala as follows. 025, 5, 1000) We give now the function in currified form and give also an example of its application. 025)(5)(1000) When the function is currified we can define a new function that computes the compound for any value when the interest and the number of years are known.

FoldLeft("")((a,b)=>a+ Map(1->"one",2->"two",3->"three",4->"four",5->"five", 6->"six",7->"seven",8->"eight",9->"nine",0->"zero")(b)+"") • foldRight. Similar to foldLeft but elements are associated on the right. In the case of the sum, both foldLeft and foldRight are equally valid to define the sum. foldRight(0)((a,b) => a+b) • reduceLeft. It is similar to foldLeft but without the initial value e0 . So, it computes: f (. . f ( f ( f (x1 , x2 ), x3 ), x4 . . , xn ). For example, we can compute the factorial of 10 as follows.

Download PDF sample

Rated 4.43 of 5 – based on 29 votes