Discuss changing the behaviour of append()
- Posted by DerekParnell (admin) Jun 07, 2014
- 5286 views
Currently this is illegal ...
sequence x x = append(1,2)
We get the error message ...
first argument of append must be a sequenceWould it be a bad thing to remove this restriction such that when appending to an atom, Euphoria would automatically build a new sequence? This would be similar to how concatenation works.
sequence x x = 1 & 2 -- No error. Creates {1,2}
In my current code, I ran across this case and had to code an explicit test to get around it. This is 'ugly' and makes the code a bit slower and larger.
function F(object A, object B) sequence x if atom(A) then x = append({A}, B) else x = append(A, B) end if return x end function

