Getting the minimum value of a list
问题 I am trying to find the minimum value of a list (as a learning experience, so without min ). My approach is the following: minimo([X], X). minimo([X,Y|Tail], N):- (X > Y, minimo([Y,Tail], Y)); (X <= Y, minimo([X,Tail], X)). This gives me the following error: Syntax error: Operator expected So my questions are: What is causing the syntax error? I will try it myself once that is fixed if it actually gives the correct value back, but would this actually be a correct approach? Thanks in advance.