Home > Archive > Prolog > March 2004 > scistus prolog and clause
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
scistus prolog and clause
|
|
| Anton 2004-03-27, 12:10 am |
| 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.
| |
|
| vahcica@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
| |
|
| vahcica@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
| |
|
| 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...
> 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.
| |
| Anton 2004-03-27, 12:10 am |
| Thanks people for all answers. Sicstus manual is not really generous with examples.
Anton
"Dave" <vd419ll@freemail.hu> wrote in message news:<c39t7t$h6r$1@namru.matavnet.hu>...[color=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...
|
|
|
|
|