Bug #1823
function "insert" should allow appending
Description
I was surprised at this -- obviously we haven't used insert
much ;-)
/**/ L := []; /**/ insert(ref L, 1, "a"); --> ERROR: Cannot index an empty list --> insert(ref L, 1, "a"); --> ^
when seems pretty reasonable to expect get
L = ["a"]
.In general: insert does not work at the end of the LIST.
History
#1
Updated by Anna Maria Bigatti about 6 hours ago
- % Done changed from 0 to 90
- Estimated time set to 0.51 h
The function actually implementing this calls insertValue
which calls insert
(in Interpreter.C
).
So I just had to add checkIndexOrEnd
which is a slightly modified copy of checkIndex
allowing an extra position after the end.