C-Prolog question - construct atom '12' 
Author Message
 C-Prolog question - construct atom '12'

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'.


Erik Baalbergen

PS. Please don't tell me that name(N, [39,49,50,39]) is the solution :-)
--

Vrije Universiteit / Dept. of Maths. & Comp. Sc.
De Boelelaan 1081
1081 HV Amsterdam / The Netherlands             tel. +31 20 548 8080



Tue, 18 May 1993 19:49:26 GMT  
 C-Prolog question - construct atom '12'

Quote:

>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




Wed, 19 May 1993 02:51:51 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Beginner's J question #12 - locales

2. 'reading' atoms into terms

3. Cobol II 'substring' Construct

4. US-NYC-d'town - Smalltalk VisualWorks consultant - 12 mth contract - major brokerage

5. Smalltalk VM + Sybase OCS 12 dll's probplem

6. Cobb's 12 rules of RDBMS

7. Problem with Novell Netware 3.12+win'95 station+funcion disksize(funcky)

8. Summer '87 on Windows 95 / Novell v3.12

9. GPCE'02 - Registration deadline: Thursday, 12 sep

10. CFP ASIAN'99: Asian Computing Science Conference, Phuket,Dec 10-12,1999

11. FW: The goal of K-12 CS education

 

 
Powered by phpBB® Forum Software