Project

General

Profile

Bug #1823

function "insert" should allow appending

Added by Anna Maria Bigatti about 7 hours ago. Updated about 6 hours ago.

Status:
New
Priority:
Normal
Category:
bug
Target version:
Start date:
01 Jul 2024
Due date:
% Done:

90%

Estimated time:
0.51 h
Spent time:

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.

Also available in: Atom PDF