Code Comments
Programming Forum and web based access to our favorite programming groups.Hi, I keep getting the error shown below in Sicstus Context error: declaration appeared in query When I run the same code under gprolog it works fine and I get the expected result. I can not find any reference as to why the above error is created or how to overcome the error. I would be grateful if anyone could point me in the right direction. Thanks, Adam
Post Follow-up to this messageAdam Gent wrote: > Hi, > > I keep getting the error shown below in Sicstus > > Context error: declaration appeared in query > > When I run the same code under gprolog it works fine and I get the > expected result. > > I can not find any reference as to why the above error is created or > how to overcome the error. > > I would be grateful if anyone could point me in the right direction. > > Thanks, > > Adam You could have given us more of the error message and then we wouldn't have to guess which declaration you have put in a query ... But here is something that shows the same message: at the toplevel of SICStus: | ?- dynamic(foo/1). ! Context error: declaration appeared in query ! goal: dynamic foo/1 | ?- mode(foo(+)). ! Context error: declaration appeared in query ! goal: mode foo(+) | ?- meta_predicate(foo(-)). ! Context error: declaration appeared in query ! goal: meta_predicate foo(-) Enough for you ? Look up the goal part in the manual ... Cheers Bart Demoen
Post Follow-up to this messageBart Demoen <bmd@cs.kuleuven.ac.be> wrote in message news:<1112647546.957213@seven.kulnet.k
uleuven.ac.be>...
> Adam Gent wrote:
>
> You could have given us more of the error message and then we wouldn't
> have to guess which declaration you have put in a query ...
Hi,
One of the queries that fail is
is_a_module_no(ModuleNumber):-
(
module(ModuleNumber, _)
->
write('Module Exists')
;
write('Module Does Not Exist')
).
when calling is_a_module_no(cmo101).
Part of the module decleration is
module(cmo101, module_details('Maths 101', 'Sally Johnson')).
module(cmo102, module_details('Programming 102', 'Peter Pan')).
Thanks,
Adam
Post Follow-up to this messageAdam Gent <adam@misthos.com> wrote:
> One of the queries that fail is
> is_a_module_no(ModuleNumber):-
> (
> module(ModuleNumber, _)
> ->
> write('Module Exists')
> ;
> write('Module Does Not Exist')
> ).
> module(cmo101, module_details('Maths 101', 'Sally Johnson')).
> module(cmo102, module_details('Programming 102', 'Peter Pan')).
Adam,
module/2 has a special role in SICStus (see manual) so you cannot call
any of your binary predicates "module".
Gertjan
--
Gertjan van Noord Alfa-informatica, RUG, Postbus 716, 9700 AS Groningen
vannoord at let dot rug dot nl http://www.let.rug.nl/~vannoord
Post Follow-up to this messageAdam Gent wrote:
> is_a_module_no(ModuleNumber):-
> (
> module(ModuleNumber, _)
> ->
> write('Module Exists')
> ;
> write('Module Does Not Exist')
> ).
>
> when calling is_a_module_no(cmo101).
>
> Part of the module decleration is
>
> module(cmo101, module_details('Maths 101', 'Sally Johnson')).
> module(cmo102, module_details('Programming 102', 'Peter Pan')).
You seemed to have missed what SICStus is so kind to tell you:
* module/2 - NOT redefined
What you wrote was not a module declaration, but facts for a module/2
predicate - and SICStus doesn't like it at all.
Post Follow-up to this message> > One of the queries that fail is > > > > > > Adam, > > module/2 has a special role in SICStus (see manual) so you cannot call > any of your binary predicates "module". Gertjan, Thanks you, after I change the module entries it worked fine. Thanks, Adam
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.