Re: Discuss changing the behaviour of append()
- Posted by gimlet Jun 09, 2014
- 5187 views
Derek,
I was aware of the (inconsistent?) behaviour of one element sequences. You can have append do what you want by calling append as:
append(S[1..1], 2) -- coercing S[1] to a sequence
Some clarification.
sequence S = {0,1,2,3} ? length(S[1..0]) -- 0 ? sequence(S[1..0]) -- true ? atom(S[1..0]) -- false ? length(S[1..1]) -- 1 ? sequence(S[1..1]) -- true (slice coerces sequence type) ? atom(S[1..1]) -- false ? length(S[1]) -- 1 (odd!) ? sequence(S[1]) -- false (odd!) ? atom(S[1]) -- true ? append(S[1..1],2) -- {0,2} ? append(S[1],2) -- error

