Skip to content

Instantly share code, notes, and snippets.

@ahoka ahoka/rot90.fs
Created Jan 27, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.