concept operation in category scala

appears as: operations, n operation, operations, operation, operation, The operation
Get Programming with Scala

This is an excerpt from Manning's book Get Programming with Scala.

To understand the execution of a Scala program, let’s compare it with the typical execution flow of a Java Program: figure 1.2 provides a visual representation of the two processes. The JVM is a machine to perform tasks by executing a well-defined set of operations, called bytecode. A JVM language aims to translate its code into executable JVM bytecode, usually formed by multiple files with extension *.class. When coding in Java, you save your source files with extension *.java and use the compiler javac to produce a jar file containing the generated bytecode. When writing Scala code, your source files have extension *.scala. scalac is the Scala compiler in charge of translating the code into bytecode. It is built on top of javac so it can interpret Java code as well Scala one: this makes its integration with Java extremely easy.

In the previous unit, you have learned about List and the operations you can perform on it. In this lesson, you’ll discover the collection Set as an immutable representation of a group of elements. Sets and lists have many features in common and similar syntax, with a fundamental difference: the items of a set are unique and have no order. You’ll see how to create it, and how to add and remove elements from it. You’ll discover how to manipulate its items using the map, flatten, and flatMap operations. Finally, you’ll chain multiple instances of Set using a for-comprehension statement. In the capstone, you’ll use sets to store the book loans of a library.

scala> Map(1 -> "hello", 2 ->"scala") - 1
res0: scala.collection.immutable.Map[Int,String] = Map(2 -> scala)
// Removing entry with key 1
 
scala> Map(1 -> "hello", 2 ->"scala") - 3
res1: scala.collection.immutable.Map[Int,String] = 
Map(1 -> hello, 2 -> scala)
   // Removing a non-existing key returns the original Map.