Re: Sequence trouble

new topic     » goto parent     » topic index » view thread      » older message » newer message

> sequence data
> data[1]=12
> data[2]=23
> data[3]=54
> data=append(data,{data[1],data[2],data[3]})
>
> ex.err results: data=<no value>

Hi Eduardo,
Maybe you write wrong the code in your mail, but maybe the bug is
that you declared the sequence "sequence data" and then just started
doing "data[x]=y" wich is WRONG. You must first give a value to
"data" so Euphoria knows it's shape.. just after declaration, "data"
is an empty sequence "{}". You code should look like this:

    sequence data
    data = {12,23,54}
    data=append(data,{data[1],data[2],data[3]})

Now data should be:
{12,23,54,{12,23,54}}

Other way could be:

    sequence data
    data = repeat({},3)    --Replace "3" with the length you want
    data[1]=12
    data[2]=23
    data[3]=54
    ...

If you want to make a sequence of sequences ("{{1,1,1},{1,1,1}....}")
then use something like:

     sequence data
     data=repeat(repeat({},3),10)
     data[1][1]=xxx
     data[1][2]=xxx
     data[1][3]=xxx
     ....
     data[10][3]=xxx

This creates a sequence ("data") of length 10, and each of this
elements is a sequence itself of length 3.

Hope this helps...



Regards,
  Daniel Berstein
  danielberstein at usa.net
  http://www.geocities.com/SiliconValley/Heights/9316

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu