9 lines
161 B
Text
9 lines
161 B
Text
% Swapping positions in a list/array
|
|
swap2(L) =>
|
|
swap_list(L,1,2).
|
|
|
|
% Swap two elements in a list
|
|
swap_list(L,I,J) =>
|
|
T = L[I],
|
|
L[I] := L[J],
|
|
L[J] := T.
|