1. beginner question

Maybe I'm not understanding sequences as well as I think,  but what 
happens if you don't know what the length of the sequence is at the 
start of the program and you want to keep adding to it?  Do I have to 
initialize an extra long sequence of a large amount,  in my case say 
1000 elements to be sure?  If so,  how do I do that?  Do I have to write 
out x{"","","","","", etc.  1000 times?  I'm confused.

new topic     » topic index » view message » categorize

2. Re: beginner question

On Wednesday 23 January 2002 11:59 pm, you wrote:
>
> To "add to it," as you'd like to do, use append():
> mySeq = append(mySeq, anotherSeq)
>
> You can also use the following:
> mySeq &= anotherSeq
>
> I think. I'm not so sure about that last one.

append() and "&=" give very different results. Try this:
include print.e
sequence s1,s2

s1 = "Cat"
s2 = "Cat"
s1 = append(s1,"Dog")
s2 &= "Dog"

? s1
? s2

You'll see that the first instance - append - results in creating a new 
"subsequence' embedded within the first:   {67,97,116, {68,111,103} }
more or less "Cat{Dog}"
while the second method  -"&=" - results in a concatenating of the two 
strings :  {67,97,116,68,111,103}   or "CatDog".

If you are wanting to create an "array" of strings: i.e. {"Cat","Dog"}, then 
s1 = append({s1},s2) does the job.

Hint: download Gabriel Boehm's print.e include file from the Euphoria 
archives, it lets  you see the contents of these things in plain English.
Regards,
Irv

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

Search



Quick Links

User menu

Not signed in.

Misc Menu