I'm kind of confused between the difference of the two following lists:
K = [1,2,3 | X].
and
K = [1,2,3,X].
The question in the book of Bratko is actually in the context of conc.
conc is defined as:
conc([], L, L).
conc([X|L1], L2, [X|L3]) :- conc(L1, L2, L3).
The actual question now is if in
conc([1,2,3], [X], L2).
L2 is the same list as K in the query K = [1,2,3|X].
I don't think L2 and K are the same, but I'm not so sure how to explain it. L2 is the concatenation of two lists. K is the concatenation of something I'm not sure of with a variable X that can be filled in by a list...
Still learning Prolog, so forgive me if this is a 'stupid' question.
![[1,2,3,X] vs [1,2,3|X]](https://i.stack.imgur.com/SkS8n.png)
conc([1,2,3],[X],[1,2,3,X])andconc([1,2,3],X,[1,2,3|X])both hold. That's actually very visually intuitive, especially the first one. - Will Ness