background preloader

Scala

Facebook Twitter

Macros

Scaladays2012. Scala School - Testing with specs. This lesson covers testing with Specs, a Behavior-Driven Design (BDD) Framework for Scala. extends Specification nested examples Execution Model Setup and TearDown doFirst doBefore doAfter Matchers mustEqual contains sameSize?

Scala School - Testing with specs

Write your own Mocks Spies run in sbt extends Specification Let’s just jump in. import org.specs._ object ArithmeticSpec extends Specification { "Arithmetic" should { "add two numbers" in { 1 + 1 mustEqual 2 } "add three numbers" in { 1 + 1 + 1 mustEqual 3 } } } Arithmetic is the System Under Specification. Performance Characteristics. Effective Scala. Table of Contents Other languages 日本語Русский简体中文.

Effective Scala

What do <:<, <%<, and =:= mean in Scala 2.8, and where are they documented. 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.

Collections

Escalate Software. Escalate software is in the process of creating a series of screencasts for Scala information sharing and training purposes.

Escalate Software

The first available screencasts are provided here for free and cover the new features of Scala 2.8. In the longer term we will create training materials in the form of these videos along with supporting material that will be for sale from this and other sources as well. These first videos give you the chance to see if you like this format and can get value out of it without risk. For now, the videos are hosted on YouTube, and here are a couple tips for getting the most out of your viewing experience When watching the video, select at least 480p or 720p from the video quality selector towards the bottom right of the video player window. New screencast links will appear below as we release them, so keep an eye on this page. We hope you enjoy this series of screencast videos and that they bring you value.

Scalafx

Sbt. Continuations. Scala Casts: Screencast about Scala. Getting-started. Jpa. Functional Scala: Essential list functions. In the last two episodes we came up with the basic idea of persistent (read immutable) list-like data structures and how to construct and deconstruct (read pattern match) them using a sugarized notational form.

Functional Scala: Essential list functions

We also talked big about their non-destructive nature when it comes to e.g. updating a given list or removing some elements. In this episode, we’ll finally inspect some of those commonly used list functions. While we’re going to reimplement the most essential ones, you’ll hopefully get a better feeling for the basic principles and characteristics which build the foundation for operating on persistent data structures in a non-destructive way (preserving the structure of given list values). Retrieving an element For a smooth entry into the world of functions on persistent list structures, let’s first take a look at some non-destructive functions. That wasn’t too difficult. So what’s going on here? Inserting an element So how could we achieve it? Replacing an element Summary. Scala IDE for Eclipse Space. Implicit capture with implicitly.

The easy and digestable way to understand view in Scala. Views can be difficult to understand.

The easy and digestable way to understand view in Scala

It is presented at times in a way that can make it even more difficult to understand. In creating a Scala Koan , I decided to make a koan that makes it easy to grok what a view is all about. In this example, I create list of Ints 1 through 6 and call it lst . lst has two maps. A map takes a function and invokes that function on each element of a collection. The first map in my example will print out in stdout what will actually be doubled and then doubles that element. The results: scala> val lst = 1 :: 2 :: 3 :: 4 :: 5 :: 6 :: Nil scala> lst.map{x => println("Doubling %s".format(x)); x*2} .map{x => println("Adding 1 to %s".format(x)); x + 1} Doubling 1 Doubling 2 Doubling 3 Doubling 4 Doubling 5 Doubling 6 Adding 1 to 2 Adding 1 to 4 Adding 1 to 6 Adding 1 to 8 Adding 1 to 10 Adding 1 to 12 res1: List[Int] = List(3, 5, 7, 9, 11, 13)

Betting Exchange Research Blog: Moving from Java to Scala - One year later... Reading this Scala evaluation please put a bit of attention to what is it about and what it is not.

Betting Exchange Research Blog: Moving from Java to Scala - One year later...

For sure, I'm not trying to examine Scala just by looking only at its design, syntax and other language capabilities. Instead of that, I'm aiming to answer the questions raised in the introduction above. Scala 2.8 Collections API. The Architecture of Scala Collections.

Lift

Cheat sheet for scala syntax. Programming Scala. Scala Examples - Advanced. To compile and run on Windows one of the above Scala programs, let's say sort.scala, we can simply proceed as follows: > mkdir classes > scalac -d classes %SCALA_HOME%\doc\scala-devel\scala\examples\sort.scala > scala -cp classes examples.sort [6,2,8,5,1] [1,2,5,6,8] The name of the Scala executable is examples.sort where examples is the name of the package containing the sortobject.

Scala Examples - Advanced

Running the test on a Unix system is very much similar, except for the use of slashes instead of backslashes, and a different specification of the Scala home directory.

Actors

Querying a Dataset with Scala's Pattern Matching. This post is about matching patterns against collections, combining patterns in interesting ways and defining patterns in terms of other patterns.

Querying a Dataset with Scala's Pattern Matching

Patterns defined in this way look and feel like a lightweight, domain specific query language. Very little supporting code is required. Akka. Code: Starting with Akka and Scala. Update to this post: I have upgraded the examples to Akka 1.0-RC1. this newer post might be more helpful.

Code: Starting with Akka and Scala

I recently started playing around with Scala. I had read a lot about Scala before but never got around really doing anything with it. I was looking for some (probably Java) libraries that would make a couple of things really easy: Easy concurrencyInterop with Java or in JavaDistributed computing nodesEvent drivenHighly scalableLow bandwidth usage for communicating between nodes (so no XML)Pluggable data formatEasy development of message exchanges, asynchronous, one way, two way, synchronous, etcPossible (but hopefully not necessary) distributed state/databaseReliable when failures happenEasy integration with a range of communication protocols / endpointsAt first I found BSON as a data format, as part of the mongodb project.

Quick after that I found Google Protobuf which was a better candidate for me. Com.scalacentral:liftweb:1.0-SNAPSHOT. Scala Standard Library (2.8.0) — _root_