Domain

The domain of a function is the range that all inputs to the function can be within. For instance, a function that returns the square root of a number must have an input that is a positive integer. Therefore, we say "the domain of the square root consists only of numbers greater than or equal to 0"

A well-defined function must map every element of its domain to an element of its co-domain

  • This idea is encapsulated in the concept of pure functions. A function is pure if the same inputs have the same outputs. This shows a perfect mapping from input -> output