Path: 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 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