![]() |
Scala adheres to expression-centric philosophy design, where anything can be evaluated to produce value. This is a way to be more expressive and follow the principles of functional programming. Substitution Model in ScalaThe substitution model is a fundamental concept in programming. It provides a way to understand how expressions are evaluated. In this model, start by breaking down expressions into smaller sub-expressions and evaluating them individually. This is done by replacing function arguments with their corresponding values, followed by evaluating the value of the function, repeated until we reach a final result.
An expression that can’t be reduced to a value: Scala
Explanation: In the above code we are defining a function whose value is declared as itself. So, when the code is run, it starts by trying to evaluate the value of function loop, it’s value is decarled as loop, so it then makes a function call to the function loop, which itself creates another function call. ![]() Function calling itself This is recurvise function calling, for which there is no termination defined. Hence this is a non terminating recursive function. |
Reffered: https://www.geeksforgeeks.org
Scala |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 14 |