Method code for $list.swap()

[Turn on line numbering]
arg list, a, b;
var holder;

// swap elements at indexes a and b
if (listlen(list) < a || listlen(list) < b || a < 1 || b < 1)
    throw(~args, "Index specifiers are outside the range of the list.");
anticipate_assignment();
holder = list[a];
list = replace(list, a, list[b]);
list = replace(list, b, holder);
return list;

["// Created 26-Mar-1995 as a part of ColdCore, see: @help Credit"]

the Cold Dark