You can't write
Val >= 0 :-
memb(Index, Addr, Val).
because in Prolog before :- is the head of the rule and after is the body.
The head of the clause must either aaa :- or aaa(X) :- or aaa(X,Y) :- or ...
You can write
memb(Index, Addr, Val) :- Val >= 0.
This means that memb(Index, Addr, Val) succeeds if Var >= 0.
At compile-time you will have a warning about Index and Addr baecause they arne not used. To avoid this w<arningyou can write
memb(_Index, _Addr, Val):- Val >= 0.
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.