Appending to a list

Ilya Zakharevich <[email protected]>
Newsgroups gmane.comp.mathematics.pari.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.