Builtin sequence operations?
Question for RC mainly:
Nowadays, the fastest way to insert an element inside a sequence appears to
be:
target_sequence &= 0 --add dummy element at the end to get some more
storage space
target_sequence[insertion_point+1..$] =
target_sequence[insertion_point..$-1] -- shift sequence tail 1 position
right
target_sequence[insertion_point] = new_value -- now set the right spot
and similarly to remove an element.
Wouldn't it be desirable to increase code effiiciency as well as to spare
coders' fingers, to have a builtin
insert(target_sequence,insertion_point,new_value) and
remove(target_sequence,removal_point) ?
If sequences are implemented as linked lists, this should be far more
efficient than the current best method, right?
CChris
|
Not Categorized, Please Help
|
|