You can use sublistto save what you want from the list.
For example, delete the last 4 items in the list: sublist list1 0 (length list1 - 4)
You can generalize this to a function:
to-report remove-last-n [ lst n ]
report sublist lst 0 (length lst - n)
end
which you can use as follows: remove-last-n list1 4
Combining this, unfortunately, with the name sentence, you can remove arbitrary sublists:
to-report remove-sublist [ lst position1 position2 ]
report (sentence (sublist lst 0 position1) (sublist lst position2 length lst))
end
which allows you to do
observer> show remove-sublist [-17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0] 2 13
observer: [-17 -16 -4 -3 -2 -1 0]
source
share