From nicos@soi.city.ac.uk Sat Apr  7 16:05:17 2001
Received: from altair.soi.city.ac.uk (altair.soi.city.ac.uk [138.40.91.7])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f37E5H329678
	for <prolog@swi.psy.uva.nl>; Sat, 7 Apr 2001 16:05:17 +0200 (MET DST)
Received: from localhost (nicos@localhost)
	by altair.soi.city.ac.uk (8.11.2/8.11.2) with SMTP id f37E5E011791;
	Sat, 7 Apr 2001 15:05:14 +0100 (BST)
Date: Sat, 7 Apr 2001 15:05:14 +0100 (BST)
From: Nicos Angelopoulos <nicos@soi.city.ac.uk>
To: Kourakos-Mavromichalis Evagelos <emav@aegean.gr>
cc: "'prolog@swi.psy.uva.nl'" <prolog@swi.psy.uva.nl>
Subject: Re: [SWIPL] Converting terms to strings
In-Reply-To: <81FBBA8C21B9D311A6E500508B6144AA02B187@eupalinos.aegean.gr>
Message-ID: <Pine.GSO.4.02A.10104071503560.10270-100000@altair.soi.city.ac.uk>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII


try,

% pl
Welcome to SWI-Prolog (Version 4.0.2)
Copyright (c) 1990-2000 University of Amsterdam.
Copy policy: GPL-2 (see www.gnu.org)
For help, use ?- help(Topic). or ?- apropos(Word).
?- term_to_atom( box(red,'is red'), Atom ), atom_codes( Atom, Codes).
Atom = 'box(red, \'is red\')'
Codes = [98, 111, 120, 40, 114, 101, 100, 44, 32|...]


Nicos.


On Fri, 6 Apr 2001, Kourakos-Mavromichalis Evagelos wrote:

> Hello,
> I'd like to know if it's possible to convert a term like:
> box(red,'is red')
> to a list:
> [ A1, A2,..., A17 ]
> where Ax are the ASCII values of chars of the term.
> 
> I think that the only build in predicate that achieves this is the 
> string_to_list( ?String, ?List ). 
> but how we convert the box(red,'is red') to a string?
> 
> Also, is it possible to write such terms that contains strings to text
> files?
> 
> Thanks in advance,
> Vangelis Mavromichalis
> PhD Student
> 
> 
> ----------------
> * To UNSUBSCRIBE, please use the HTML form at
> 
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist
> 
> or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe"
> (without the quotes) and *no* message body.
> 
> ** An ARCHIVE of this list is maintained at
> 
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/
> 

