background preloader

Scala

Facebook Twitter

Scala’s Types of Types. Value classes have been around in Scala for a long time internally, and you’ve used them already many times because all Number’s in Scala use this compiler trick to avoid boxing and unboxing numeric values from int to scala.Int etc.

Scala’s Types of Types

As a quick reminder, let’s recall that Array[Int] is an actual JVM int[] (or for bytecode happy people, it’s the JVM runtime type called: [I) which has tons of performance implications, but in one word — arrays of numbers are fast, arrays of references not as much. Ok, since we now know the compiler has fancy tricks to avoid boxing ints into Ints when it doesn’t have to. Let’s see how this feature is exposed for us, end users since Scala 2.10.x.

The feature is called "value classes", is fairly simple to apply to your existing classes. Using them is as simple as adding extends AnyVal to your class and following a few rules listed bellow. And the bytecode generated for the value class bellow: These are the basics around extension methods and value classes. Learning Scala in small bites. Learning with the REPL.

Learning Scala in small bites

Effective Scala. Table of Contents Other languages 日本語Русский简体中文 Introduction Scala is one of the main application programming languages used at Twitter.

Effective Scala

Aemoncannon/ensime. Hvesalai/scala-mode2. Heathermiller/progfun-stats. Functional Programming Principles in Scala: Impressions and Statistics. By Heather Miller and Martin Odersky In this post, we discuss our experience giving the popular MOOC Functional Programming Principles in Scala, and provide some insight into who our course participants were, how, overall, students performed in the course, and how students felt about the course.

Functional Programming Principles in Scala: Impressions and Statistics

Bloxorz. Overview (Java Platform SE 6) Slick. ScalaQuery. Monads in Scala. Here's the beginning of a little tutorial on Monads in Scala.

Monads in Scala

Michel Schinz provided encouragement and large parts of code, especially the trick to use bind and unit In Informatics, there are two (related) meanings of the word "monad": A triple (T,eta,mu) following some laws in category theory A way of structuring functional programs The first meaning can probably not be described easily in natural language. Michael Arbib and Ernest Manes' "Arrows, Structure, Functors - The Categorical Imperative". describe them as (generalized monoids) in Section 10.2 and through adjointness to the forgetful functor from algebras to sets. Www.berniepope.id.au/docs/scala_monads.pdf. Monads are Elephants Part 1. Introductions to monads are bit of cottage industry on the Internet.

Monads are Elephants Part 1

So I figured, "why buck tradition? " But this article will present Scala's way of dealing with monads. An ancient parable goes that several blind men were experiencing their first elephant. "It's a tree," one said while wrapping his arms around its legs. "A large snake," another said while holding its trunk. From this parable we can conclude this: the ancients believed that the visually impaired like to fondle large mammals. We're also supposed to learn something about how our limitations can prevent us from grasping the whole picture and that we're all blind in some way. I think there's a third lesson to be learned - the opposite of the main intent: that it's possible to learn much about the big picture by getting a series of limited explanations.

Monads are Container Types One of the most commonly used container types is List and we'll spend some time with it. Scalacheat. Scala Tutorial. Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way.

Scala Tutorial

Scala has been created by Martin Odersky and he released the first version in 2003. Scala smoothly integrates features of object-oriented and functional languages. This tutorial gives a great understanding on Scala. This tutorial has been prepared for the beginners to help them understand programming Language Scala in simple and easy steps. After completing this tutorial, you will find yourself at a moderate level of expertise in using Scala from where you can take yourself to next levels. Scala Programming is based on Java, so if you are aware of Java syntax, then it's pretty easy to learn Scala. If you are willing to learn the Scala programming on a Linux machine but you do not have a setup for the same, then do not worry. Scala Standard Library API (Scaladoc) 2.10.1 - root - Scala Standard Library API (Scaladoc) 2.10.1 - _root_

Structure and Interpretation of Computer Programs. Introduction. Scala is a modern multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way.

Introduction

It smoothly integrates features of object-oriented and functional languages. Scala is object-oriented Scala is a pure object-oriented language in the sense that every value is an object. Types and behavior of objects are described by classes and traits. Scala School. Other Languages: About Scala school started as a series of lectures at Twitter to prepare experienced engineers to be productive Scala programmers.

Scala School

Scala is a relatively new language, but draws on many familiar concepts. Thus, these lectures assumed the audience knew the concepts and showed how to use them in Scala. We found this an effective way of getting new engineers up to speed quickly. Approach We think it makes the most sense to approach teaching Scala not as if it were an improved Java but instead as a new language. Most of the lessons require no software other than a Scala REPL.

Programming in Scala, First Edition. Programming in Scala, First Editionby Martin Odersky, Lex Spoon, and Bill VennersDecember 10, 2008 Martin Odersky made a huge impact on the Java world with his design of the Pizza language.

Programming in Scala, First Edition

Although Pizza itself never became popular, it demonstrated that object-oriented and functional language features, when combined with skill and taste, form a natural and powerful combination. Pizza's design became the basis for generics in Java, and Martin's GJ (Generic Java) compiler was Sun Microsystem's standard compiler starting in 1.3 (though with generics disabled). I had the pleasure of maintaining this compiler for a number of years, so I can report from first-hand experience that Martin's skill in language design extends to language implementation.

Since that time, we at Sun tried to simplify program development by extending the language with piecemeal solutions to particular problems, like the for-each loop, enums, and autoboxing. Glossary. Oscon keynote: Working hard to keep it simple. Programming in Scala, First Edition. Programming in Scala, First Editionby Martin Odersky, Lex Spoon, and Bill VennersDecember 10, 2008 Martin Odersky made a huge impact on the Java world with his design of the Pizza language.

Although Pizza itself never became popular, it demonstrated that object-oriented and functional language features, when combined with skill and taste, form a natural and powerful combination. Pizza's design became the basis for generics in Java, and Martin's GJ (Generic Java) compiler was Sun Microsystem's standard compiler starting in 1.3 (though with generics disabled). I had the pleasure of maintaining this compiler for a number of years, so I can report from first-hand experience that Martin's skill in language design extends to language implementation. Since that time, we at Sun tried to simplify program development by extending the language with piecemeal solutions to particular problems, like the for-each loop, enums, and autoboxing. 'scala' tag wiki. Getting Started — Scala IDE documentation. Installation Scala IDE for Eclipse is best installed (and updated) directly from within Eclipse. This is done by using Help → Install New Software..., add the Add... button in the dialog.

Choose a name for the update site (Scala IDE is an obvious choice). Then read the next section to select which version you will install. Choosing what version to install The list of URLs of the different update sites are available in the download area. Typesafe - the stack built to scale featuring Scala, Akka and Play. Scala IDE for Eclipse. Download Latest Version of IntelliJ IDEA. Effective Scala.