In this section, we will learn about giving arguments a type, how to return values from a function, how to define refinements, how to document a function, and how to do error-handling with functions.
Function attributes
Passing arguments
Here, we must make a distinction between single, so called scalar! values, such as numbers, dates, chars, and so on (See The type system section in Chapter 3, Using Words, Values, and Types), and all other values:
- Scalar values are passed by value, which means that a copy of the value is sent to the function
- Other values are passed by reference, which means that a reference to the value is sent to the function
The consequence of this is that scalar values cannot be changed by a function...