Subject: Re: [SWIPL] How to convert atoms to reals

From: Tom Breton <[email-masked]>
Date: 22 May 2001 13:29:53 -0400

João Mariz <[email-masked]> writes:

> Hello SWI-Prolog users,
> 
> I am sorry for taking your time with such simple questions.
> 
> However, I am trying to convert code from another prolog interpreter,
> and I am still a newbie in SwiProlog and xpce. Althought I spend several
> hours searching in the users guide for predicates that could resolve me
> this question and I did not succeed.
> 
> So please tell me how can I convert from an atom to a real to preform
> later some calculations? Or where can I find this answers in the Users
> Guide.

In the SWI manual, "3.20 Analysing and Constructing Atoms",
atom_to_term does that.  I don't know how that interacts with XPCE,
tho.

1 ?- atom_to_term('12.3', My_real, _), A is My_real + 1.0.

My_real = 12.3
A = 13.3 

Yes

-- 
Tom Breton, http://world.std.com/~tob