I would like to compare two lists considering and comparing every one of their subterms also. For example, if I have the lists [1, t1(2, t2(3), 4)]
and [1, t1(2, t2(2), 4)]
, the result should be that the first one is greater (>
) than the second one, because 3 > 2
in terms t2
(which are part of the term t1
).
I thought of something like this:
cmp([1, t1(2, t2(3), 4)], [1, t1(2, t2(2), 4)], X).
X = >
So the input would be two list, and the output is a mathematical symbol indicating the relation between them.
Maybe my question is a little bit messy, but can this be done somehow?
Edit:
Sorry, I forgot to mention that I would like to compare the numbers arithmetically, all the other terms by the standard order. This is why I got stuck a little bit.