alice-teacher Setters for a List

Paul Flaherty flaherty.p at gmail.com
Tue Apr 12 13:33:27 EDT 2011


I'm not sure what happened, but at some point between April 2010 and April
2011, I lost track of how to set the value of individual items in a list in
Alice.

Last year, I did a lesson to teach my HS Intro students the basics of how to
sort. We made a list in Alice, populated it with integers, wrote a swap
method to swap to values in an array, and Bubble Sorted it in place.

This year, I'm trying to do it again, but I can't figure out how to get
Alice to let me change the value of an individual item in a list The
equivalent, with a Java ArrayList, would be:

int n = list.get(position2);
list.set(position2, list.get(position1));
list.set(position1, n);

I can get the getters to work, but I can't figure out where the setters
went. Was this functionality removed?

In the meantime, I'll teach my kids Selection Sort instead, and I guess
we'll sort in-place in Java. The "watch this variable" function of Alice is
awesome for showing students how the sort works, though.

Thanks for the help,

Paul Flaherty
Mathematics | Computer Science
Westwood Regional Jr./Sr. High School
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110412/a72d640d/attachment.html 


More information about the alice-teachers mailing list