Program to check if a sublist appears in a list in the same order

I’m a newbie trying to study Prolog. I’m trying to write a program to check if a sublist appears in a list in the same order but I’m getting stuck. Can someone help me in this, please?

You need to explain a bit better. How is a sublist defined? Is this homework? (often homework assignments come with strange requirements like “don’t use append/3” or “you must use recursion”)

I presume this is homework, so here’s just a tip: can you write this check in a functional language? A function that returns a boolean is called a predicate. So, if you have f: [A] x [A] → Boolean you can easily translate this function to a Prolog predicate - just write out the cases where your function returns True.

Prolog is a bit different, because you can use append/3 as a relation (not as a function!). Both “substring” and “subsequence” can be expressed in terms of append/3. Both solutions are very easy to find, literally a couple of clicks or a search away from this post.

I think ‘sublist’ here does not necessarily mean a continuous chunk, so append/3 may not be as straight-forward to use here.

I don’t want to help OP too much. There is a solution for “substring” in the examples to append/3; there is a solution for “subsequence” here on discourse, just use the search.