Re: Discuss changing the behaviour of append()
- Posted by kinzz Jun 12, 2014
- 3941 views
Can you point out where there are any logic errors in this function or discussion of mine, please.
The code I posted earlier was the working code. My first attempt at this function used the append() function but that failed at times, due to it trying to append to an atom.
Instead of ...
S[I[1]] &= {X}
my original function had
integer n = I[1] S[n] = append(S[n], X)
This fails when the item at S[n] is an atom.
There is nothing amazing that "this fails". Manual reads: Syntax: s2 = append(s1, x)
You had to append to the sequence, not to an atom.
Your logic was erroneous, you thought that S[n] can not be an atom.
But why not ???
If S={1,2,3,4} then S[3]=3
The atom!
That above was about the function logic.
And there is no any reason to tell on append() if your function works after correction with append() and (much better) with &.
This is about the discussion logic.
But if you wanna another append(), it is fully another story.
Regards
kinz