1. Tutorial on sequences

Hi to any Euphorian who knows a lot about sequences,

I like to add a sequence (append) to another sequence.
For example :
given :
seq1 =3D {{1,2,3,4},{5,6,7,8},{9,10,11,12}}
seq2 =3D {20,30,40}
result should be:
seq1 =3D {{1,2,3,4,20},{5,6,7,8,30},{9,10,11,12,40}}

How can this be done without much overhead ??
I believe it is easy,but I can't get it.

TIA Karlheinz =



 =

new topic     » topic index » view message » categorize

2. Tutorial on sequences

untested code
for i =3D 1 to 4 do
    seq1[i] =3D seq1[i] & seq2[i]
end for

--Alan

---------------------------------------------------------------
Visit my web page, including the Question of the Week poll, at:
http://ourworld.compuserve.com/homepages/atu5713/

>>>>>
I like to add a sequence (append) to another sequence.
For example :
given :
seq1 =3D {{1,2,3,4},{5,6,7,8},{9,10,11,12}}
seq2 =3D {20,30,40}
result should be:
seq1 =3D {{1,2,3,4,20},{5,6,7,8,30},{9,10,11,12,40}}
<<<<<
 =

new topic     » goto parent     » topic index » view message » categorize

3. Re: Tutorial on sequences

Karlheinz Nester wrote:
>
> Hi to any Euphorian who knows a lot about sequences,
>
> I like to add a sequence (append) to another sequence.
> For example :
> given :
> seq1 = {{1,2,3,4},{5,6,7,8},{9,10,11,12}}
> seq2 = {20,30,40}
> result should be:
> seq1 = {{1,2,3,4,20},{5,6,7,8,30},{9,10,11,12,40}}
>
> How can this be done without much overhead ??
> I believe it is easy,but I can't get it.
>
> TIA Karlheinz
>
sequence seq1, seq2

seq1 = {{1,2,3,4},{5,6,7,8},{9,10,11,12}}
seq2 = {20,30,40}
for i = 1 to length(seq1) do
 seq1[i] = append(seq1[i],seq2[i])
end for
puts(1,"{{1,2,3,4,20},{5,6,7,8,30},{9,10,11,12,40}} -- desired
result\n")
print(1,seq1)
puts(1," -- actual result")

Regards,

Irv

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu