users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what's the corresponding predcate as atomic_list_concat in swi


From: Daniel Diaz
Subject: Re: what's the corresponding predcate as atomic_list_concat in swi
Date: Wed, 26 Jun 2013 20:22:15 +0200

Hi,

the easiest way to convert numbers to atoms and then use atom_concat/3. This 
should work:

atomic_concat(X1, X2, A3) :-
        to_atom(X1, A1),
        to_atom(X2, A2),
        atom_concat(A1, A2, A3).

to_atom(A, A) :-
        atom(A), !.

to_atom(X, A) :-
        number_atom(X, A).


Daniel

Le 26 juin 2013 à 08:39, Sean Charles <address@hidden> a écrit :

> Hi z_axis,
> 
> I looked long and hard and I couldn't find anything suitably matched in the 
> atom and character code sections … sorry.
> 
> I think somebody that *knows* the language has an opportunity to hand-roll 
> something at this point… I will also try to do this as an exercise, it will 
> be good to try.
> 
> My initial thought would be to use a stream writing to an atom, then write 
> each atom in the original list plus the intervening comma for all but the 
> last atom. 
> 
>    open_output_atom_stream ...
>    write_term_to_atom  … each list member plus a comma
>    close_output_atom_stream ...
> 
> Simples. Except I just have to do it. And if it could be used "backwards" to 
> split the atom then so much the better, like SWI.
> 
> I am sure somebody else will do it first but I like the look of this so I 
> shall try as well.
> 
> Sean.
> 
> 
> 
> 
> On 26 Jun 2013, at 03:15, z_axis <address@hidden> wrote:
> 
>> It seems there is just atomic_concat in gprolog ?
>> Mime-Version: 1.0
>> Content-Type: Text/Plain; charset=iso-8859-7
>> Content-Transfer-Encoding: base64
>> X-CM-TRANSID:C8CowEApvUUWT8pR28F5Cw--.21S2
>> X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73
>>      VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxU2t8nUUUUU
>> X-CM-SenderInfo: x2bd5xrv6rljoofrz/1tbiThZIZlEAFN07UAABsE
>> 
>> ZV4o8C5pKSArIDEgPSAwDQo=
>> 
>> 
>> _______________________________________________
>> Users-prolog mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/users-prolog
> 
> 
> _______________________________________________
> Users-prolog mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/users-prolog
> 
> -- 
> Ce message a ete verifie par MailScanner
> pour des virus ou des polluriels et rien de
> suspect n'a ete trouve.
> 


-- 
Ce message a ete verifie par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a ete trouve.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]