chess960 in OCaml — Main Function

let positions = genpositions ()

let _ =
  if Array.length Sys.argv = 1
  then print positions
  else begin
    Random.self_init ();
    print (choose (int_of_string Sys.argv.(1)) positions)
  end
# length positions;;
- : int = 960
# choose;;
- : int -> 'a list -> 'a list = <fun>
# choose 3 (1--100);;
- : int list = [10; 62; 73]
# choose 3 positions;;
- : piece list list =
[[R; Q; B; K; R; B; N; N]; [N; B; R; Q; K; R; B; N];
 [B; B; N; R; Q; K; N; R]]
# choose 1 positions;;
- : piece list list = [[N; R; B; B; N; K; R; Q]]
# print (choose 1 positions);;
RNKNBRQB
- : unit = ()
#