Re: Discuss changing the behaviour of append()

new topic     » goto parent     » topic index » view thread      » older message » newer message
jaygade said...
mattlewis said...
DerekParnell said...
object X, Y 
X = 4      Y = {8,9}  X &= {Y} --Result is {4, {8,9}} 
X = {4}    Y = {8,9}  X &= {Y} --Result is {4, {8,9}} 
X = {4,5}  Y = {8,9}  X &= {Y} --Result is {4, 5, {8,9}} 
X = {}     Y = {8,9}  X &= {Y} --Result is {{8,9}} 

So, if the change is made to Euphoria's append()/prepend() functions to do this, programs that now currently fail in this situation will no longer fail. Is that okay?

This seems like a positive change.

Matt

Maybe I'm not following very closely and misunderstanding. How in the first case would you concatenate to make a single-level sequence?

object X, Y 
X = 4      Y = {8,9}  -- what operation do I need to form {4, 8, 9}? 
X = {4, 5} Y = {8,9}  -- what operation do I need to form {4, 5, 8, 9}? 
X = "foo"  Y = "bar"  -- what operation do I need to form "foobar"? 

It's like this:

object X, Y 
X = 4      Y = {8,9}  X &= Y --Result is {4, 8, 9} 
X = 4      Y = {8,9}  X &= {Y} --Result is {4, {8,9}} 
X = {4}    Y = {8,9}  X &= Y --Result is {4, 8, 9} 
X = {4}    Y = {8,9}  X &= {Y} --Result is {4, {8,9}} 
X = {4,5}  Y = {8,9}  X &= Y --Result is {4, 5, 8, 9} 
X = {4,5}  Y = {8,9}  X &= {Y} --Result is {4, 5, {8,9}} 
X = "foo"  Y = "bar"  X &= Y --Result is "foobar" 
X = "foo"  Y = "bar"  X &= {Y} --Result is NOT "foobar" 

Basically, if you combine the concatenation operator with the new sequence operation, you've got a more expensive version of append.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu