Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Sicstus: Context error: declaration appeared in query
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

Report this thread to moderator Post Follow-up to this message
Old Post
Adam Gent
04-06-05 05:44 PM


Re: Sicstus: Context error: declaration appeared in query
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

Report this thread to moderator Post Follow-up to this message
Old Post
Bart Demoen
04-06-05 05:44 PM


Re: Sicstus: Context error: declaration appeared in query
Bart 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

Report this thread to moderator Post Follow-up to this message
Old Post
Adam Gent
04-06-05 05:44 PM


Re: Sicstus: Context error: declaration appeared in query
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

Report this thread to moderator Post Follow-up to this message
Old Post
vannoord@let.rug.nl
04-06-05 05:44 PM


Re: Sicstus: Context error: declaration appeared in query
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.

Report this thread to moderator Post Follow-up to this message
Old Post
Bart Demoen
04-06-05 05:44 PM


Re: Sicstus: Context error: declaration appeared in query
> > 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

Report this thread to moderator Post Follow-up to this message
Old Post
Adam Gent
04-06-05 05:44 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Prolog archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:59 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.