Re: ignoring { } ?

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

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 thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu