View Single Post
You've found a software bug -- Here's a quick fix.
Posts: n/a
Default You've found a software bug -- Here's a quick fix. - 02-22-2007, 06:54 PM

Hello Dr. Jim,

First, you are right. Remove item from end of (list name) doesn’t work properly – for list variables. It does work for a list created as a ListVisualization object.

I looked at the error code and found that an index out of bounds exception was being generated. I believe the underlying code is trying to delete item N from a list with N items. Since the list numbering starts with 0, it should be trying to delete item N-1 from a list with N items.

(This underlying problem is very reminiscent of things that happen in CS1 the first time students write their own programs to access arrays. I’ve also seen it in professional programs where good programmers simply were off by one. Fortunately, in this case NASA won’t lose a space probe because of a software error.)

Quick fix – to delete an item from the end of a list, delete the item from position [size of list] – 1. See the modified attached world.
Attached Files
File Type: a2w List Test2.a2w (365.1 KB, 571 views)
Reply With Quote