Scala
7 flashcards · Programming Languages · by charlie42
Difference between defining a function in Scala and in Python
Scala: def hello(): Unit
What does "First class function" refers to
Programming language is said to have first-class functions if it treats functions as first-class citizens. This means: passing functions as arguments to other functions, returning them as the values from other functions, assigning them to variables, storing them in data structures
What's functional programming?
It's a way to organize code in a way that makes it easier to write and read Make functions behave like mathematical functions First class citizens No side effects Make variables immutable
What's an expression in a programming language?
A sequence of symbols that evaluates to a value (of a type the programming language supports).
What are statements in a programming language?
No formal definition, each language defines a list of what counts as a statement. Generally a piece of instruction to a computer (e.g. variable definition or a loop)
What are algebraic data types?
Data types created by combining other data types using two algebraic operations: sum (union): a value can be ONE of several defined types product: contains ALL specified types at once
What's a sealed trait
A type that can be exactly one of some other types