Re: Discuss changing the behaviour of append()
- Posted by jimcbrown (admin) Jun 09, 2014
- 4327 views
ArthurCrump said...
ryanj said...
Why not just use & then? What's the advantage of append(), anyway? I don't think i ever use it.
a = {1,2} & {3,4} -- and b = append({1,2},{3,4})
give different results:
a is {1,2,3,4}
b is {1,2,{3,4}}
Arthur
But you can easily simulate the behavior of append like this:
a = {1,2} & {{3,4}} -- and b = append({1,2},{3,4})
It's a good way to make up for the lack of an append= operator:
a &= {{3,4}} -- and b = append(b,{3,4})