Created
January 27, 2016 15:53
-
-
Save ahoka/67dcaf121ddd80841635 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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