In accordance with our meta agreement, since one candidate received more votes than the others, we have a new featured language! Throughout January 2021, our Language of the Month will be:


What's a Language of the Month?

See the meta post for nominations. In short, during January, those who wish to participate should learn (at least the basics of) Scala, and use it to solve challenges. Participation is completely optional, but is anticipated to be fun!

Information about Scala

Scala is a general-purpose programming language that combines OOP and FP and improves a lot on Java. It mainly runs on the JVM, but there's also Scala Native and ScalaJS.

Some nice things about it:

  • Concise (and pleasing) syntax that sometimes makes it feel like a scripting language (here is a comparison between ScalaJS and ES6 and TypeScript.
  • The standard library is amazing and has useful methods such as filter, combinations and collect.
  • Implicits are very powerful and can be used for everything from simply reusing values to doing logic programming at compile time.
  • Type inference means you don't need to declare types explicitly, except for method parameters (and return types in recursive methods).
  • For comprehensions are a lot shorter than using multiple flatMaps and filters, and you can even create variables without using the val keyword inside them.
  • Pattern matching is convenient, and helps in destructuring declarations.
  • User-defined operators save bytes. list1.concat(list2) can be replaced with list1 ++ list2. Infix and postfix (the latter is deprecated) also save bytes.
  • Its type system is Turing complete, and using literal types and a couple dependencies, you can even do compile time operations on primitives and such.
  • There's a research compiler called Dotty that adds a ton of features to Scala and is slated to be released as Scala 3.
  • Scala makes immutability really easy - all you have to do is use val instead of using final SomeType, like in Java.



Answers in Scala will be eligible for a bounty of 50 rep if you have not posted an answer in Scala before. Sorry, but if it's a question that I (user) have already answered, I'll only award the bounty to an exceptional answer, since it starts at 100 rep.


1 Answer 1


List of all Scala solutions posted in January 2021

(First time posters highlighted in bold)

List of all Scala tips posted in January 2021

List of Scala-related challenges posted in January 2021

  • Pascal's Fibonacci Triangle by user

  • add entries in the form:

      [<challenge title>](https://codegolf.stackexchange.com/q/<question-ID>) by [username](https://codegolf.stackexchange.com/users/<user-ID>)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .