Gray code by ksk

let(%)=List.map
let n=read_int()let rec($)i l=i=0&[]<print_endline%l;i-1$(^)"0"%l@List.rev((^)"1"%l);;Printf.printf"Gray code  n=%d
"n;n$[""]

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

download

return to the top page