Check out the standard predicates writeq/[1,2], write_canonical([1,2],
or write_term/[2,3]-
P.
On Sun, Jun 21, 2009 at 11:54 PM, Tony Drapkin<
tony@...> wrote:
> Hi,
>
> I'm trying to port a program that I wrote in LPA MacProlog over to SWI
> Prolog.
>
> One of the things the program does is to write a Prolog term using the
> built-in predicate 'write' that contains string quotes.
>
> That is to say that I want to write a term that looks like this:
>
> foo('The King Of France').
>
> with the string quotes showing so that it can be compiled and read by a
> different Prolog program.
>
> However, I don't know how to to force SWI Prolog to write string quotes,
> although t is possible to do this in LPA MacProlog using the ~ symbol.
>
> The MacProlog code looks like this:
>
>
> d_write(foo(Name, FF, Rating, Symbol)):-
> write(foo) ~> data,
> write('(') ~> data,
> write('~'') ~> data, % Write opening string quote
> write(Name) ~> data, % Write string to which Name is
> instantiated
> write('~'') ~> data, % Write closing string quote
> write(',') ~> data,
> write(FF) ~> data.....etc
>
> It's clunky, but it works,
>
> How can I implement this or something like it in SWI Prolog?
>
> Any help you can give would be much appreciated.
>
> Best wishes,
>
> Tony Drapkin
>
> _______________________________________________
> SWI-Prolog mailing list
>
SWI-Prolog@...
>
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog>
_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog