Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I need to write a program in swi-prolog that removes the second value of a list. thanks!
我认为这可能很简单:
remove2nd([], []). remove2nd([X], [X]). remove2nd([X, Y|Z], [X|Z]).
你在哪里使用它:
remove2nd([1,2,3], X).
并给你
X = [1, 3].