title: Prolog, find minimum in a list
body: <p>in short: How to find min value in a list? (thanks for the advise kaarel)</p>
  
  <p>long story: </p>
  
  <p>I have created a weighted graph in amzi prolog and given 2 nodes, I am able to retrieve a list of paths. However, I need to find the minimum value in this path but am unable to traverse the list to do this. May I please seek your advise on how to determine the minimum value in the list?</p>
  
  <p>my code currently looks like this:</p>
  
  <pre>
  arc(1,2).
  arc(2,3).
  arc(3,4).
  arc(3,5).
  arc(3,6).
  arc(2,5).
  arc(5,6).
  arc(2,6).
  
  path(X,Z,A) :- 
   (arc(X,Y),path(Y,Z,A1),A is A1+1;arc(X,Z), A is 1).
  </pre>
  
  <p>thus, ' keying findall(Z,path(2,6,Z),L).' in listener allows me to attain a list [3,2,2,1].
  I need to retrieve the minimum value from here and multiply it with an amount. Can someone please advise on how to retrieve the minimum value? thanks!</p>