1. Learning Euphoria ... sequence found inside string ???

Hi,

This does NOT  work ............
             sequence found inside string 

include file.e
include get.e

sequence d
atom w

d=dir(current_dir())
    printf(1,"%s\n",{d})

w=wait_key()


yet this one does work !!!


include file.e
include get.e
sequence     d
atom w
d=dir(current_dir())
for i = 1 to length(d) do
    printf(1,"%s\n",d[i])
end for
w=wait_key()


what does .... sequence      inside    mean ???

OR where to look !!!

I cannot find it.

getting frustrated with simplicities !! 

OH WOE !!

les.r.

new topic     » topic index » view message » categorize

2. Re: Learning Euphoria ... sequence found inside string ???

Les Rogers wrote:
> 
> d=dir(current_dir())
>     printf(1,"%s\n",{d})

d is now a multi-level sequence. That is, there are sequences inside
sequences... for example:

{ 1, 2, "Sequence 1", 4, "Sequence 2", "etc." }

printf()'s "%s" cannot output that kind of sequence. It expects "flat"
sequences of integers only.

printf(1, "%s", { "This is okay." } )

printf(1, "%s", { { "This is not.", "Because it has embedded sequences." } } )

> d=dir(current_dir())
> for i = 1 to length(d) do
>     printf(1,"%s\n",d[i])
> end for

This works because you've sent a sequence element from d to printf(). The
element d[i] always contains a flat sequence (or atom).

> d=dir(current_dir())
>     printf(1,"%s\n",{d})

This would work (but not as expected) if you wrote it as

   printf(1,"%s\n",d)

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

3. Re: Learning Euphoria ... sequence found inside string ???

Les Rogers wrote:
> 
> 
> Hi,
> 
> This does NOT  work ............
>              sequence found inside string 
> 
> include file.e
> include get.e
> 
> sequence d
> atom w
> 
> d=dir(current_dir())
>     printf(1,"%s\n",{d})
> 
> w=wait_key()
> 
> 
> yet this one does work !!!
> 
> 
> include file.e
> include get.e
> sequence     d
> atom w
> d=dir(current_dir())
> for i = 1 to length(d) do
>     printf(1,"%s\n",d[i])
> end for
> w=wait_key()
> 
> 
> what does .... sequence      inside    mean ???
> 
> OR where to look !!!
> 
> I cannot find it.
> 
> getting frustrated with simplicities !! 
> 
> OH WOE !!
> 
> les.r.

  Hello les,
sequence found inside string line 3 of myprog.ex

This is a common error that I get all the time.

To fix it. Go to that line and change d to d[1].

If you still get it change to d[1][1].

In other words puts(1,d) --dosen't work

puts(1,d[1]) --dosen't work --keep doing this untill it works

puts(1,d[1][1]-- works

Once it does work and prints something you will see where your error is.

Another example:

sequence names

names=("les","don","ccris"}

puts(1,names}--sequence found inside string error

puts(1,names[1]-- prints les

Oh I see, I have to identify each element of the sequence with a number.

Don Cole

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

Search



Quick Links

User menu

Not signed in.

Misc Menu