// guess the programming language of the day

$ whois scala

Scala

first released in 2003 · by Martin Odersky

$ guessprog --inspect scala

year
2003
paradigm
multi paradigm
family
c like
memory
automatic gc
binding
static
safety
strong

SCALA(7)

AUTHORS
Martin Odersky
HISTORY
Martin Odersky started designing Scala in 2001 at EPFL, the Swiss Federal Institute of Technology in Lausanne, and released it publicly in 2004. Odersky had previously worked on Generic Java and on the Java compiler, and wanted a language for the JVM that fused object-oriented and functional programming. The name stands for "scalable language", meaning it should grow with the needs of its users. Scala 3, a major redesign based on a new formal foundation called DOT, was released in 2021.
USAGE
A niche but influential JVM language, used mostly for data engineering and distributed systems: Apache Spark is written in it, and it is popular in companies running large backend services. Its popularity has declined since the mid-2010s, partly as Java and Kotlin adopted many of its ideas.
SEE ALSO
Scala on Wikipedia ↗
$ cat expr.scala
sealed trait Expr
case class Num(n: Int) extends Expr
case class Add(a: Expr, b: Expr) extends Expr
case class Mul(a: Expr, b: Expr) extends Expr

def eval(e: Expr): Int = e match
  case Num(n)    => n
  case Add(a, b) => eval(a) + eval(b)
  case Mul(a, b) => eval(a) * eval(b)

@main def run(): Unit =
  println(eval(Add(Num(2), Mul(Num(3), Num(4)))))