Re: Discuss changing the behaviour of append()
- Posted by gimlet Jun 12, 2014
- 4581 views
Derek,
We agree that a function's parameters should be validated before entering the function. This is why I have said:
The real problem is not append but A[i] being an atom.
My point with the various slices is that every slice is a sequence but A[i] is possibly not.
It would seem reasonable (to me at least) that A[i] and A[i..i] ought be interchangeable.
Therefore I am inclined to say the difficulty with append is with the (ambiguous) nature of A[i].
I don't think that append shoud be changed as restricting the target type to sequence is a good restriction.
append(A[i], x) -- yes append(1,2) -- no
Obviously with call-by-value the function wouldn't know the difference.
I don't know how the caller could differentiate cleanly except with a sequencing operator (an idea which seems to have been rejected)

