Lists

Deconstructing lists

We can take the first element of a list and the remaining elements like so

?- [First|Rest] = [1, 2, 3]
First = 1,
Rest = [2, 3].

Last updated

Was this helpful?