Questions tagged [scala]

Scala is a general-purpose programming language principally targeting the Java Virtual Machine. Designed to express common programming patterns in a concise, elegant, and type-safe way, it fuses both imperative and functional programming styles. Its key features are: an advanced static type system with type inference; function types; pattern-matching; implicit parameters and conversions; operator overloading; full interoperability with Java; concurrency

Scala is a general-purpose programming language principally targeting the Java Virtual Machine. Designed to express common programming patterns in a concise, elegant, and type-safe way, it fuses both and styles. Its key features are:

  • Static typing
  • Advanced type system with type inference and declaration-site variance
  • Function types (including anonymous) which support lexical closures
  • Pattern-matching
  • Implicit parameters and conversions which support the typeclass and enrich-my-library patterns
  • Mixin composition
  • Full interoperability with Java
  • Powerful concurrency constructs
  • Advanced language constructs such as delimited continuations and an experimental macro system

For more information, see the official Scala Introduction and Scala Documentation.

To search for Scala symbols such as => in Stack Overflow, you can use symbolhound search.

To search Scala documentation, you can use scalex.

A community list of available libraries is available at Awesome Scala

There is Scala Library Index by Scala Center: Scaladex.

Free Scala programming books and guides

Stack Overflow Scala Tutorial

  1. Introduction to Scala
  1. Variables/values
  1. Methods
  1. Literals, statements and blocks
  1. Loops/recursion
  1. Data structures / Collections
  1. For-comprehension
  1. Enumeration
  1. Pattern matching
  1. Classes, objects and types
  1. Packages, imports and visibility identifiers
  1. Inheritance
  1. Extractors
  1. Case classes
  1. Parameterized types
  1. Traits
  1. Self references
  1. Error handling
  1. Type handling
  1. Annotations
  1. Functions/Function literals
  1. Type safety
  1. Implicits
  1. Reflection
  1. Enrich-my-library pattern (formerly known as pimp-my-library)
  1. Concurrency overview
  2. Actors
  1. Use Java from Scala and vice versa
  1. XML literals
  • Explanation
  1. Scala Swing
  1. Type Programming
  1. Functional Scala

Further learning

  1. Learning Resources
  1. REPL
  1. Working with scalac and scala
  1. Operator precedence
  1. Scala style
  1. Functional Programming Principles in Scala, a functional programming course on Coursera taught by Martin Odersky, the creator of Scala.
  2. Principles of Reactive Programming, a reactive functional programming course on Coursera taught by Martin Odersky, Erik Meijer, Roland Kuhn.
  3. Parallel Programming, a parallel programming course on Coursera taught by Viktor Kuncak and Aleksandar Prokopec.
111781 questions
18 answers

Is the Scala 2.8 collections library a case of "the longest suicide note in history"?

I have just started to look at the Scala collections library re-implementation which is coming in the imminent 2.8 release. Those familiar with the library from 2.7 will notice that the library, from a usage perspective, has changed little. For…
  • 133,303
  • 56
  • 317
  • 449
13 answers

Difference between object and class in Scala

I'm just going over some Scala tutorials on the Internet and have noticed in some examples an object is declared at the start of the example. What is the difference between class and object in Scala?
  • 21,163
  • 21
  • 69
  • 92
6 answers

Scala vs. Groovy vs. Clojure

Can someone please explain the major differences between Scala, Groovy and Clojure. I know each of these compiles to run on the JVM but I'd like a simple comparison between them.
James Fassett
  • 40,306
  • 11
  • 38
  • 43
12 answers

What are the best use cases for Akka framework

I have heard lots of raving about Akka framework (Java/Scala service platform), but so far have not seen many actual examples of use cases it would be good for. So I would be interested in hearing about things developers have used it…
  • 113,358
  • 34
  • 211
  • 239
7 answers

What are all the uses of an underscore in Scala?

I've taken a look at the list of surveys taken on and noticed a curious question: "Can you name all the uses of “_”?". Can you? If yes, please do so here. Explanatory examples are appreciated.
  • 63,011
  • 101
  • 250
  • 382
17 answers

What is the difference between Scala's case class and class?

I searched in Google to find the differences between a case class and a class. Everyone mentions that when you want to do pattern matching on the class, use case class. Otherwise use classes and also mentioning some extra perks like equals and hash…
Teja Kantamneni
  • 17,402
  • 12
  • 56
  • 86
1 answer

Scalaz iteratees: "Lifting" `EnumeratorT` to match `IterateeT` for a "bigger" monad

If I have an EnumeratorT and a corresponding IterateeT I can run them together: val en: EnumeratorT[String, Task] = EnumeratorT.enumList(List("a", "b", "c")) val it: IterateeT[String, Task, Int] = IterateeT.length (it &= en).run : Task[Int] If the…
  • 17,386
  • 3
  • 26
  • 37
2 answers

Where does Scala look for implicits?

An implicit question to newcomers to Scala seems to be: where does the compiler look for implicits? I mean implicit because the question never seems to get fully formed, as if there weren't words for it. :-) For example, where do the values for…
Daniel C. Sobral
  • 295,120
  • 86
  • 501
  • 681
11 answers

What do all of Scala's symbolic operators mean?

Scala syntax has a lot of symbols. Since these kinds of names are difficult to find using search engines, a comprehensive list of them would be helpful. What are all of the symbols in Scala, and what does each of them do? In particular, I'd like to…
  • 66,707
  • 21
  • 171
  • 266
11 answers

What is the difference between self-types and trait subclasses?

A self-type for a trait A: trait B trait A { this: B => } says that "A cannot be mixed into a concrete class that does not also extend B". On the other hand, the following: trait B trait A extends B says that "any (concrete or abstract) class…
  • 7,589
  • 12
  • 36
  • 42
8 answers

What is the advantage of using abstract classes instead of traits?

What is the advantage of using an abstract class instead of a trait (apart from performance)? It seems like abstract classes can be replaced by traits in most cases.
  • 14,655
  • 9
  • 48
  • 58
4 answers

Scala list concatenation, ::: vs ++

Is there any difference between ::: and ++ for concatenating lists in Scala? scala> List(1,2,3) ++ List(4,5) res0: List[Int] = List(1, 2, 3, 4, 5) scala> List(1,2,3) ::: List(4,5) res1: List[Int] = List(1, 2, 3, 4, 5) scala> res0 == res1 res2:…
Luigi Plinge
  • 50,650
  • 20
  • 113
  • 180
11 answers

How do I get around type erasure on Scala? Or, why can't I get the type parameter of my collections?

It's a sad fact of life on Scala that if you instantiate a List[Int], you can verify that your instance is a List, and you can verify that any individual element of it is an Int, but not that it is a List[Int], as can be easily verified: scala>…
Daniel C. Sobral
  • 295,120
  • 86
  • 501
  • 681
1 answer

What is a TypeTag and how do I use it?

All I know about TypeTags is that they somehow replaced Manifests. Information on the Internet is scarce and doesn't provide me with a good sense of the subject. So I'd be happy if someone shared a link to some useful materials on TypeTags including…
Sergey Weiss
  • 5,944
  • 8
  • 31
  • 40
5 answers

Difference between a Seq and a List in Scala

I've seen in many examples that sometimes a Seq is being used, while other times is the List... Is there any difference, other than the former one being a Scala type and the List coming from Java?
  • 60,462
  • 79
  • 252
  • 386
2 3
99 100