1. ignoring { } ?
- Posted by useless Mar 20, 2010
- 1032 views
\\ i = 2\\ \\ list = {}\\ list &= i\\ list &= i\\ list == {2,2}\\ \\ list = {}\\ list &= {i}\\ list &= {i}\\ list == {2,2}\\ \\ list &= i == list &= {i} ?\\ \\
useless
2. Re: ignoring { } ?
- Posted by dcole Mar 20, 2010
- 1019 views
\\ 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
3. Re: ignoring { } ?
- Posted by useless Mar 20, 2010
- 1039 views
\\ 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.
4. Re: ignoring { } ?
- Posted by petelomax Mar 20, 2010
- 1036 views
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
5. Re: ignoring { } ?
- Posted by DerekParnell (admin) Mar 21, 2010
- 945 views
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.
6. Re: ignoring { } ?
- Posted by petelomax Mar 21, 2010
- 935 views
- Last edited Mar 22, 2010
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