Hello Jonathan,
First a note about two other answers I got in private e-mail:
* Luis: the predicate name/2 is not enough, because I was to stringigy terms, not just atoms.
* Jason sent me code that does it; thanks Jason. However the question was rather if there is a way to re-use the code that is already there in the Prolog library.
On Thu, May 08, 2003 at 05:18:38PM +0200, Jonathan Hodgson wrote:
stringifying 9or atomifying) things is soemthing one needs to do a lot. Perhaps we should look into the "informal" prolog standard group. Most implmentatation provide some way to do it so we really need a simple common name and mode for it.
SWI Prolog has not only 'format/2' and 'format/3' predicates, but also an 'sformat/3' which emits its result to a string, which I found very convenient. For the problem I mentioned, we can use the "~w" formatter.
However, the stream concept of all Prolog implementations I know seems very old-fashioned to me; doesn't any give the user a way to define his own streams (i.e. objects that would be usable in lieu of streams in the built-in predicates, but whose byte-level read and write operations are user-defined predicates) ? That would nicely solve this and other problems.
A bientôt,
Armin. ============================================================================== Message: Address: Action: help majordomo(a)clip.dia.fi.upm.es Info. on useful commands subscribe ciao-users-request(a)clip.dia.fi.upm.es Subscribe to this list unsubscribe ciao-users-request(a)clip.dia.fi.upm.es Unsubscribe from this list <whatever> ciao-users(a)clip.dia.fi.upm.es Send message to list ----------------------------------------------------------------------------- Archived messages: http://www.clip.dia.fi.upm.es/Mail/ciao-users/ -----------------------------------------------------------------------------