Code Termination

In this lesson, we will learn how some expressions might terminate under CBN, but not under CBV.

Both CBV and CBN will reduce an expression to the same value as long as the expression is guaranteed to terminate. But what if a piece of code is not guaranteed to terminate?

  • If the CBV evaluation of an expression terminates, then the CBN evaluation of the same expression will also terminate.
  • If the CBN evaluation of an expression terminates, then the CBV evaluation of the same expression is not guaranteed to terminate.

Let’s look at an example of an expression which terminates under CBN, but not under CBV.

Create a free account to access the full course.

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