title: Finding the longest list in Prolog?
body: <p>I need to write a predicate longestList/2 such that longestList(L1,L2) is satisfied if L2 is the longest
  nested list from the list of lists L1.</p>
  
  <pre><code>?- longestList([[1],[1,2],[1,2,3],[1,2,3,4]],LI).
  LI = [[1, 2, 3, 4]] ;
  No
  ?- longestList([[a,b,c],[d,e],[f,g,h]],LI).
  LI = [[f, g, h],[a,b,c]];
  No
  </code></pre>
  
  <p>Could someone please help me with intuition to go about solving it?</p>