Scala

7 flashcards · Programming Languages · by charlie42

  1. Difference between defining a function in Scala and in Python

    Scala: def hello(): Unit

  2. 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

  3. 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

  4. What's an expression in a programming language?

    A sequence of symbols that evaluates to a value (of a type the programming language supports).

  5. 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)

  6. 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

  7. What's a sealed trait

    A type that can be exactly one of some other types