Determining if a list is empty or not
<p>I want to do some if | else stuff in prolog. Below is my code, Prolog will return 'R = false' if my input list is not empty, it will return 'false' if my list is empty. What do I miss?</p>

<p>Code:</p>

<pre><code>isEmpty([H|T],R) :- 
    length([H|T],L),
    ( L &gt; 0 -&gt; R = 'false'
    ;
    L =:= 0 -&gt; R = 'true'
    ).
</code></pre>

<p>Prolog Output:</p>

<pre><code>1 ?- isEmpty([],R).
false.

2 ?- isEmpty([1],R).
R = false.

3 ?- isEmpty([1,2,3],R).
R = false.
</code></pre>