toneydiscount
Programmer
Hello,
I am trying to become familiar with prolog and I am trying to do a simple compare of two lists.
For example, let's say that I provide two prolog facts:
list1([a,b,c]).
list2([w,x,y,z]).
Now how would I compare the two, I know there is length function but not sure how to use it.
Is it something like this?
Longer(List1, List2) :- length(List1, N) > length(List2, M).
So in this case it should return no becasue list2 is longer. Am I even close?
I am trying to become familiar with prolog and I am trying to do a simple compare of two lists.
For example, let's say that I provide two prolog facts:
list1([a,b,c]).
list2([w,x,y,z]).
Now how would I compare the two, I know there is length function but not sure how to use it.
Is it something like this?
Longer(List1, List2) :- length(List1, N) > length(List2, M).
So in this case it should return no becasue list2 is longer. Am I even close?