sort [a] if ~isarray[a] println “Invalid argument” error endif n:=size[a] for i:=0:n-2 k:=i for j:=i+1:n-1 k:=iff[a{j} next if i<>k t:=a{i} a{i}:=a{k} a{k}:=t endif next result:=a