I am new into prolog and I've already done some coding, but I have a task I cannot handle. Could you please tell me how to describe a working predicate, that compares arg1, arg2 and arg3 and returns yes it arg1>arg2>arg3? Many thanks in advance!
Szymon
The solution is quite easy:
Keep in mind that you cannot define predicates with an arbitrary number of input parameters (so obviously
compare/3could be called only with 3 input). To make it more flexible you can insert the element in a list and rewrite it like thisNow
myCompare/1accepts a list and return true if the list is sorted, false otherwise.