Ilya Zakharevich on Sat, 06 Jan 2024 23:40:58 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Appending to a list |
What is the logic behind this error: (14:32) gp > my(L=List([3,4,5])); L[4]=12; L *** at top-level: my(L=List([3,4,5]));L[4]=12;L *** ^-------- *** nonexistent component: index > 3 **Why** should I use listput() for this operation? It is clear that write access to L[#L+2] should be disabled; but writing to L[#L+1] seems to be completely unambiguous — and a logical thing to do… I do not see many situations where this would help to catch bugs too… Puzzled, Ilya