I need to remove the first element from a list (the head). How do I do it?
Maybe something like:
removehead([_|Tail], Tail).
Test:
prolog> removehead([1,2,3,4], R).
[2,3,4]
R
is unbound here, and is used for binding it the result.
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