Skip to content

Instantly share code, notes, and snippets.

@ahoka
Created January 27, 2016 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahoka/67dcaf121ddd80841635 to your computer and use it in GitHub Desktop.
Save ahoka/67dcaf121ddd80841635 to your computer and use it in GitHub Desktop.
let rot90 m =
let rec rot90 m acc =
if List.isEmpty <| List.head m then
List.rev acc
else
rot90 (List.map List.tail m) (List.map List.head m :: acc)
in
rot90 m []
let matrix = [[1; 2; 3;];
[6; 5; 4]]
let matrix' = rot90 matrix
List.iter (printfn "%A") matrix'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment