Help me to explain the F# Matrix transpose function

Posted by Kev on Stack Overflow See other posts from Stack Overflow or by Kev
Published on 2010-06-10T16:00:08Z Indexed on 2010/06/10 16:02 UTC
Read the original article Hit count: 168

Filed under:

There is a Matrix transpose function:

let rec transpose = function
    | (_::_)::_ as M -> List.map List.head M :: transpose (List.map List.tail M)
    | _ -> []

[[1; 2; 3]; [4; 5; 6]; [7; 8; 9]] |> transpose |> printfn "%A"

It works fine.
What does ( _ :: _ ) :: _ mean?
I don't understand the whole code!
Who can explain it?
Thank You!

© Stack Overflow or respective owner

Related posts about F#