取出 option 的值

来源:互联网 发布:mac 恢复 不了 编辑:程序博客网 时间:2024/04/29 12:46

取出 option 的值


let s (c:'a list option) =
    match c with
    | Some v -> v
    | _      -> []

let a = Some[("ABC")]

s a
//  ["ABC"]

原创粉丝点击