Dear all,
Hello,

Does any of you know prolog language well? i have a project on it that is due next week.. i just wana know how to imlement function or a struture that compares any two elements in a list and returns true if the first element comes first before the second in the list or false other wise.. i have tried but coudnt do it..

Please help as much as you can and as soon as possible.
Thank you all so much!


sincerely,
muaz

Recommended Answers

All 2 Replies

I havn't used it for a while, but maybe something like this?

compare(A,B,[A|[B|_]).
compare(A,B,[A|[_|T]):-compare(A,B,[A|T]).
compare(A,B,[_|T]):-compare(A,B,T).

Dear all,
Hello,

I have a problem in Prolog. When I consult My program and try to write in a querey the following error message occurs:

ERROR: source_sink '...' does not exist

I tried to find about this error and slove it but couldnt. can any of you help me with this?

Please help as much as you can and as soon as possible.
Thank you all so much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.