Help me to explain the F# Matrix transpose function

前端 未结 5 800
后悔当初
后悔当初 2020-12-01 14:54

There is a Matrix transpose function:

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


        
5条回答
  •  天涯浪人
    2020-12-01 15:13

    (_::_)::_ is pattern matching. _ is simply an unused variable. This would be equivalent:

    (a::b)::c as M -> List.map List.head M :: transpose (List.map List.tail M)
    

提交回复
热议问题