Home > Archive > Prolog > April 2005 > Sicstus: Context error: declaration appeared in query
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 |
Sicstus: Context error: declaration appeared in query
|
|
| Adam Gent 2005-04-06, 12:44 pm |
| 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
| |
| Bart Demoen 2005-04-06, 12:44 pm |
| Adam 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
| |
| Adam Gent 2005-04-06, 12:44 pm |
| Bart Demoen <bmd@cs.kuleuven.ac.be> wrote in message news:<1112647546.957213@seven.kulnet.kuleuven.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
| |
| vannoord@let.rug.nl 2005-04-06, 12:44 pm |
| Adam 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
| |
| Bart Demoen 2005-04-06, 12:44 pm |
| Adam 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.
| |
| Adam Gent 2005-04-06, 12:44 pm |
| > > 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
|
|
|
|
|