Code Comments
Programming Forum and web based access to our favorite programming groups.I have a problem with clause in sicstus prolog. In theory something like clause(member(X,L),Body) should work, however I got answer: !Permission error: cannot access static user:member/2 ! goal: clause(user:member(_79,_80)_86) Any ideas? Of course I consult my program where member is defined as (clasically): member(X, [X|_]). member(X, [_|L]) :- member(X, L). Lp, Anton, ml.
Post Follow-up to this messagevahcica@email.si (Anton) wrote in message news:<8ebfff67.0403161215.6f4b2766@posting.google .com>... > I have a problem with clause in sicstus prolog. > > In theory something like clause(member(X,L),Body) should work, however > I got answer: > !Permission error: cannot access static user:member/2 > ! goal: clause(user:member(_79,_80)_86) > > Any ideas? > > Of course I consult my program where member is defined as > (clasically): > member(X, [X|_]). > member(X, [_|L]) :- member(X, L). > > Lp, > Anton, ml. hi Anton Maybe member is a predefined predicate. try : clause(user:membr(_79,_80)_86) with membr(X, [X|_]). membr(X, [_|L]) :- membr(X, L). succes! Ton
Post Follow-up to this messagevahcica@email.si (Anton) wrote in message news:<8ebfff67.0403161215.6f4b2766@posting.google .com>... > I have a problem with clause in sicstus prolog. > > In theory something like clause(member(X,L),Body) should work, however > I got answer: > !Permission error: cannot access static user:member/2 > ! goal: clause(user:member(_79,_80)_86) > > Any ideas? > > Of course I consult my program where member is defined as > (clasically): > member(X, [X|_]). > member(X, [_|L]) :- member(X, L). > > Lp, > Anton, ml. hi Anton No I was wrong this will work: consult: " :-dynamic(memb/2). memb(X, [X|_]). memb(X, [_|L]) :- memb(X, L). " then in LPA I get: : ?- clause(memb(X,L),Body). X = _, L = [X|_214259] , Body = true....... hope this helps Ton
Post Follow-up to this messageIn SICStus, just put the line :- use_module(library(lists)). before you use member/2, because that is defined in the lists library module. Dave "Anton" <vahcica@email.si> wrote in message news:8ebfff67.0403161215.6f4b2766@posting.google.com... > I have a problem with clause in sicstus prolog. > > In theory something like clause(member(X,L),Body) should work, however > I got answer: > !Permission error: cannot access static user:member/2 > ! goal: clause(user:member(_79,_80)_86) > > Any ideas? > > Of course I consult my program where member is defined as > (clasically): > member(X, [X|_]). > member(X, [_|L]) :- member(X, L). > > Lp, > Anton, ml.
Post Follow-up to this messageThanks people for all answers. Sicstus manual is not really generous with ex amples. Anton "Dave" <vd419ll@freemail.hu> wrote in message news:<c39t7t$h6r$1@namru.matavnet.hu>...[colo r=darkred] > In SICStus, just put the line > :- use_module(library(lists)). > before you use member/2, because that is defined > in the lists library module. > > Dave > > "Anton" <vahcica@email.si> wrote in message > news:8ebfff67.0403161215.6f4b2766@posting.google.com...
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.