title: Prolog minimum value in a list
body: <p>I'm working on defining a predicate <code>min_in_list/2</code> that would find the smallest value on a list. If there is less than 2 elements in the list the program should output <code>"Error: There are not enough elements in the list"</code> and if an element on the list is not a digit Eg. [2,a,3]. The program should output <code>"Error: The element is not a number"</code>. I created a predicate that would find the smallest value and checking if the list has less than two values but I'm having problem on checking if an element of a list is not a digit and outputting the error message</p>
  
  <p>My code: </p>
  
  <pre><code>    min_in_list([Min],_):- write('ERROR: List has fewer than two elements.').
  min_in_list([],_):- write('ERROR: List has fewer than two elements.').
  min_in_list([Min,_],Min).
  
  min_in_list([H,K|T],M) :- 
      H =&lt; K,                           
      min_in_list([H|T],M).
  
  min_in_list([H,K|T],M) :- 
      H &gt; K,                            
      min_in_list([K|T],M).
  </code></pre>