Re: Discuss changing the behaviour of append()
- Posted by DerekParnell (admin) Jun 21, 2014
- 4039 views
gimlet said...
Just a question:
Assuming that appending/prepending to atoms is on
we have:
? append(1,{}) -- {1,{}} ? append({},1) -- {1} ? prepend(1,{}) -- {{},1} ? prepend({},1) -- {1}
I'm not saying it's wrong but don't you find the difference strange?
No I don't, because the result is identical to when the first argument is a sequence ...
-- Ensuring that the first parameter is a sequence. ? append({1},{}) -- {1,{}} ? append({},1) -- {1} ? prepend({1},{}) -- {{},1} ? prepend({},1) -- {1} -- Performing the 'equivalent' functionality using concatenate ? {1} & {{}} ? {} & {1} ? {{}}& {1} ? {1} & {}
Or putting the operation into English text ...
- Create a list such that the second argument is added, as a single element, to the set of elements in the first argument.

