First of all: I'm a newbie when it comes to Prolog, I just wrote my first lines yesterday.
I got the following assignment: Write a rule flatten(X,Y)
, which is true when
- X is a list of lists.
- Y is the list you get when you flatten X.
For example: flatten([[1,2,3],[],[3,4]], [1,2,3,3,4])
outputs "true".
My general idea was to take the first element of the first list from X and compare it to the first element of Y. But I don't really know how exactly I would do that...