For example if I have a list [1, 2| 3], would the head be 1, 2 and the tail 3? Or would the head still be 1 and the tail 2, 3?
Note:
[1, 2| 3]is not a list;[1, 2 | [3]]is.
Short answer: there is only one element in the head, [1, 2| [3]] is syntactical sugar for [1 | [2 | [3]]], so it is a list [1, 2, 3].
Prolog's lists are like Lisp lists: they consist out of two possible values: an empty list [], and a "cons" [H|T] with H the *head, and T the tail.
Most Prolog interpreters will however allow syntactical sugar like [E1, E2, E3] and [E1, E2, E3 | T]. to make it more convient to do list processing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With