Evaluation Strategies

In this lesson, we will be going over the evaluation strategy Scala uses to evaluate expressions.

The Substitution Model

Scala uses the substitution model for evaluating expressions. The idea underlying this model is that evaluation simply reduces expressions to a value.

Let’s call the squareSum function we created in the first lesson and see how the substitution model would evaluate it. To make things interesting we will pass an expression which reduces to a Double as one of the parameters.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy