Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Translate SWI Code Fragment to Sicstus

1 view
Skip to first unread message

Michael Igler

unread,
Jul 14, 2008, 9:32:49 AM7/14/08
to
I need to translate the following code, that prints out the SLD tree,
from SWI-Prolog to Sictsus. It is part of the graphviz.pl file that can
be found at :

http://www.cs.bris.ac.uk/Teaching/Resources/COMS30106/graphviz/


The problem are these two lines when I try to load it in Sicstus 4.0.4:

writes(:-A) :- !,write(':-'),writes(A).
writes(?-A) :- !,write('?-'),writes(A).


Sicstus is telling me:

! Syntax error
! , or ) expected in arguments
! in line 90
! writes ( :-
! <<here>>
! A ) :- ! , write ( :- ) , writes ( A ) .
! Approximate lines: 89-91, file: '/....../graphviz_sic.pl'
! Syntax error
! , or ) expected in arguments
! in line 91
! writes ( ?-
! <<here>>
! A ) :- ! , write ( ?- ) , writes ( A ) .

Do I need an escape charcter for the :- so it works and if so, which one
is it?

Thanks,

Michael

Jan Wielemaker

unread,
Jul 14, 2008, 11:03:46 AM7/14/08
to
On 2008-07-14, Michael Igler <michae...@web.de> wrote:
> I need to translate the following code, that prints out the SLD tree,
> from SWI-Prolog to Sictsus. It is part of the graphviz.pl file that can
> be found at :
>
> http://www.cs.bris.ac.uk/Teaching/Resources/COMS30106/graphviz/
>
>
> The problem are these two lines when I try to load it in Sicstus 4.0.4:
>
> writes(:-A) :- !,write(':-'),writes(A).
> writes(?-A) :- !,write('?-'),writes(A).

This should run on any Prolog system:

writes(:-(A)) :- !,write((:-)),writes(A).

--- Jan

0 new messages