Re: operation with sequences
- Posted by rubis at fem.unicamp.br Sep 05, 2002
- 447 views
I think all my problem come for this: sequence a atom b atom c sequence d sequence e a=3D{} b=3D1 c=3D1 d=3D{1} e=3D{1} After some "exercises", I could now understand that : a=3Db&c gives a=3D{1,1} and a=3Dd&e gives also a=3D{1,1} The same ! But the problem was that I was expecting a=3D{{1},{1}} !!!! So I "discover" :>) that to obtain a=3D{{1},{1}} I have to do this: a=3D{d}&{e} . My problem is solved. This routine from Derek: -- Convert the integers into strings and concatenate them. c =3D sprintf("%d%d",{a,b}) -- Convert the resultant string into an atom. c =3D value(c) -- Ditch the success flag and convert the atom into a sequence. c =3D {c[2]} is usefull for what I was trying to do, but now I change the way of solve=20 the problem, after understanding better the sequences. I=B4d like to thank you all for your help. Obrigado ! Rubens M. Luciano icq number 1556563 Campinas Brazil At 01:32 29/8/2002, you wrote: > >29/08/2002 11:06:13 AM, rubis at fem.unicamp.br wrote: > > > > >Simple question: > > > >It's possible to do this ? > > > >atom a > >atom b > >sequence c > >a=3D1 > >b=3D1 > > > >c=3D{11} > > > >Trying "&" or "append" I obtain only c=3D{1,1} > >Hi Rubens, >In Euphoria, an atom holds a single number, and a sequence holds a single= =20 >list of objects. An object >can hold either a single atom or a single sequence. >Your example is a bit ambiguous. It looks like you are trying to join=20 >together two numbers. > >Are these right... >a =3D 1 >b =3D 1 >=3D=3D> c =3D {11} > >a =3D 12 >b =3D 3 >=3D=3D> c =3D {123} > >a =3D 3 >b =3D 21 >=3D=3D> c =3D {321} > >It might be easier to help you if you explain a bit more about what you=20 >are trying to achieve. For >example, where do the values of 'a' and 'b' come from? What are you=20 >intending to do with 'c'? > >As it stands, with the information you have given us, the way I could=20 >suggest is to do this... > > -- Convert the integers into strings and concatenate them. > c =3D sprintf("%d%d",{a,b}) > -- Convert the resultant string into an atom. > c =3D value(c) > -- Ditch the success flag and convert the atom into a sequence. > c =3D {c[2]} > > >Hope this helps. >----------------- >Derek. > > >