Universe 动态数组相对操作(使用 -1)以一种奇怪的方式工作。
下面的操作不会像我预期的那样在位置 <1,1,5> 中添加新元素,而是将“1,1,5”添加到 DYNAMIC.ARRAY<1,1,1> 中。
DYNAMIC.ARRAY = ' '
DYNAMIC.ARRAY<1,-1,5> = '1,1,5' ; *Adds to 1,1,1 not 1,1,5 when DYNAMIC.ARRAY contains only whitespaces before this operation
但是,如果动态数组包含非空值,则相同的操作会按预期工作。执行以下代码后的最终结果将是 DYNAMIC.ARRAY<1,1,1> = '1,1,1' 和 DYNAMIC.ARRAY<1,2,5> = '1,2,5'。
DYNAMIC.ARRAY = ' '
DYNAMIC.ARRAY<-1> = '1,1,1'
DYNAMIC.ARRAY<1,-1,5> = '1,2,5' ; *Adds to right position 1,2,5 when DYNAMIC.ARRAY is initialised to non empty value before this operation
这是宇宙中的预期行为吗?