// Where we want to go for i=0 to 9 for j=i to 9 if get(j) < get(i) then swap(i, j) end end end // The program! 0 10 i j for for ifless swap // numbers can be used multiple times, // the other items are to be used exactly once each for(variable, exp, exp, code) -> code ifless(exp, exp, code) -> code swap(exp, exp) -> code variable -> exp number -> exp get(exp) -> exp // << always available, at least one level deep [+ maybe make +1 and -1 available for off-by-one-stuff]