General
Material
Lecture 1
Lecture 2
Lecture 3
Lecture 4
Lecture 5

Hint

This task is very similar to the task that the predicate element_of/2, which we saw in the lecture, is solving.

There are two cases which can be distinguished.

  1. The first element of the input list is a 0. In this case the list obviously contains 0 and element_of should succeed.
  2. The first element is not 0. In this case, the tail of the list should contain a 0. That is, element_of should be true of the tail.

Solution

Back to the exercise.