Well, I seem to need more help in the problem which is the reason for my first question.
I want to write remove_elem(L, X, Ans), where Ans will get the list L after all element X's occurrences has been removed from it.
for example: remove_elem([6,5], 5, Ans) will cause Ans = [6].
I don't have...
Wow do I feel stupid...
I have seen this predicate but didn't make the connection that if Index is left without a concrete value, it will return with the answer...
Thanks :)
Hi,
I'm new here and with Prolog.
I have done some searching for several hours, including going over some useful threads in this forum, yet did not manage to find an example of the somewhat simple task in arrays: find the index of a given element in a list,
meaning:
index(List, Element, Index)...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.