fun next_permutation do
var first = p[1]
p[1] = p[0]
p[0] = first
var i = 1
count[i] += 1
while count[i] > i do
count[i] = 0
i += 1
p[0] = p[1]
var next = p[0]
for j in [1..i[ do p[j] = p[j+1]
p[i] = first
first = next
count[i] += 1
end
end
lib/actors/examples/fannkuchredux/fannkuchredux.nit:50,2--70,4