Permutations by mrpingouin

let rec(!)p n d=n<0&()=Printf.printf"%s\n"(String.concat" "(List.map string_of_int(List.rev p)));for i=0to n do!((d i)::p)(n-1)(fun m->d(m+1-Obj.magic(m<i)))done;;![]5(fun x->x)

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top