1. ignoring { } ?

\\ 
i = 2\\ 
\\ 
list = {}\\ 
list &= i\\ 
list &= i\\ 
list == {2,2}\\ 
\\ 
list = {}\\ 
list &= {i}\\ 
list &= {i}\\ 
list == {2,2}\\ 
\\ 
list &= i == list &= {i} ?\\ 
\\ 

useless

new topic     » topic index » view message » categorize

2. Re: ignoring { } ?

useless said...
\\ 
i = 2\\ 
\\ 
list = {}\\ 
list &= i\\ 
list &= i\\ 
list == {2,2}\\ 
\\ 
list = {}\\ 
list &= {i}\\ 
list &= {i}\\ 
list == {2,2}\\ 
\\ 
list &= i == list &= {i} ?\\ 
\\ 

useless

I don't undestand
.

I know it's force line break in the forum, but I don't know what it's doing in your code.

Also I've never seen == in euphoria what does it mean ?

Don Cole

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

3. Re: ignoring { } ?

dcole said...
useless said...
\\ 
i = 2\\ 
\\ 
list = {}\\ 
list &= i\\ 
list &= i\\ 
list == {2,2}\\ 
\\ 
list = {}\\ 
list &= {i}\\ 
list &= {i}\\ 
list == {2,2}\\ 
\\ 
list &= i == list &= {i} ?\\ 
\\ 

useless

I don't undestand
.

I know it's force line break in the forum, but I don't know what it's doing in your code. </quote> I don't know either. When i previewed it, all the eu code was on one line, which isn't where i put it. So i added the forum's formatting code for line feeds, and then wrapped it in the forum's code for syntax coloring. Apparently there's a interaction between color and line feeds. <quote> Also I've never seen == in euphoria what does it mean ?

Don Cole

Boolean test.

None of this answered the question at all.

useless, now seeing []quote and <>eucode tags are intermixed.

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

4. Re: ignoring { } ?

Is this about creole tags, or are you writing some Eu code, and using &= when you ought to be using append()?

sequence x 
x = {1}  x &= 1             ?x            -- {1,1} 
x = {1}  x &= {1}           ?x            -- {1,1} 
x = {1}  x = append(x,1)    ?x            -- {1,1} 
x = {1}  x = append(x,{1})  ?x            -- {1,{1}} 


&= concatenates two strings/atoms, whereas append always increases the length by 1

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

5. Re: ignoring { } ?

Kat said...
list &= i == list &= {i} ? 

Your post is a little light on detail, but I'm assuming you are asking the question ...

Why does list &= i and list &= {i} give the same result?

The &= operator concatenates data rather than appends data. By this I mean that & joins two sets of data together while append() adds one item to the end of a sequence.

sequence list = {} 
integer i = 2 
list &= i  -- join everything on the righthand side to the 'list' 
           -- As 'i' is just a single integer, then only one integer is added. 
           -- The 'list' length is increased by 1. 
 --> {2} 
list &= {i}  -- join everything on the righthand side to the 'list' 
             -- As '{i}' is a list containing a single integer, then only one integer is added. 
             -- The 'list' length is increased by 1. 
 --> {2} 
list &= {i,i}  -- join everything on the righthand side to the 'list' 
               -- As '{i,2}' is a list containing two integers, then both are added. 
               -- The 'list' length is increased by 2. 
 --> {2,2} 

The append() operation is different in that it only ever adds one thing to the list. The argument is added as a single element.

list = append(list,i)  -- append the righthand side to the 'list' 
                       -- The 'list' length is increased by 1. 
 --> {2} 
list = append(list, {i})  -- append the righthand side to the 'list' 
                          -- The 'list' length is increased by 1. 
 --> {{2}} 
list = append(list, {i,i})  -- append the righthand side to the 'list' 
                            -- The 'list' length is increased by 1. 
 --> {{2,2}} 


By the way, you don't need to insert manual line breaks inside EUCODE tags.

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

6. Re: ignoring { } ?

FWIW, I found that potentially still a little confusing. Either insert more list={} statements or change the result lines thus:

sequence list = {} 
list &= 1  -- join everything on the righthand side to the 'list' 
           -- As '1' is just a single integer, then only one integer is added. 
           -- The 'list' length is increased by 1. 
 --> {1} 
 
list &= {2}  -- join everything on the righthand side to the 'list' 
             -- As '{2}' is a list containing a single integer, then only one integer is added. 
             -- The 'list' length is increased by 1. 
 --> {1,2} 
 
list &= {3,4}  -- join everything on the righthand side to the 'list' 
               -- As '{3,4}' is a list containing two integers, then both are added. 
               -- The 'list' length is increased by 2. 
 --> {1,2,3,4} 
list = {} 
list = append(list,1)  -- append the righthand side to the 'list' 
                       -- The 'list' length is increased by 1. 
 --> {1} 
 
list = append(list, {2})  -- append the righthand side to the 'list' 
                          -- The 'list' length is increased by 1. 
 --> {1,{2}} 
 
list = append(list, {3,4})  -- append the righthand side to the 'list' 
                            -- The 'list' length is increased by 1. 
 --> {1,{2},{3,4}} 

Hopefully I'm not being too fussy

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

Search



Quick Links

User menu

Not signed in.

Misc Menu