🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #1473

Re: C-Prolog question - construct atom '12'

#1473
From: Francois-Michel Lang
Date: Fri, 30 Nov 1990 18:51
21 lines
1417 bytes
In article <8389@star.cs.vu.nl> erikb@cs.vu.nl (Erik Baalbergen) writes:
>How can I dynamically construct atom '12' in Pereira's C-Prolog (version 1.5)?
>Apparently, I cannot use name/2.  Both name(12, L) and name('12', L) bind
>L to [49,50], but name(N, [49,50]) binds N to integer 12, not to atom '12'.

The short answer is:  You can't.

This problem is precisely the reason for built-ins
like atom_chars/2 and number_chars/2 in Quintus Prolog,
because there are perfectly legitimate atoms like '12'
which cannot be constructed by name/2.

If you get really desperate, you could always write out

'12'.

to a file and then read it back in :-)
----------------------------------------------------------------------------
Francois-Michel Lang                                (215) 648-2536
Unisys Center for Advanced Information Technology   lang@prc.unisys.com      
Dept of Comp & Info Science, U of PA                lang@linc.cis.upenn.edu
Technical Details
Message-ID: <15795@burdvax.PRC.Unisys.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!emory!gatech!udel!burdvax!lang
References: <8389@star.cs.vu.nl>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!emory!gatech!udel!burdvax!lang
From: lang@PRC.Unisys.COM (Francois-Michel Lang)
Newsgroups: comp.lang.prolog
Subject: Re: C-Prolog question - construct atom '12'
Message-ID: <15795@burdvax.PRC.Unisys.COM>
Date: 30 Nov 90 18:51:51 GMT
References: <8389@star.cs.vu.nl>
Sender: news@PRC.Unisys.COM
Organization: Unisys Corporation, Paoli Research Center; Paoli, PA
Lines: 21