Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
F# 列表上的扩展方法?_F#_Extension Methods - Fatal编程技术网

F# 列表上的扩展方法?

F# 列表上的扩展方法?,f#,extension-methods,F#,Extension Methods,如何在F#列表上定义扩展方法 像这样天真的尝试会导致错误: type list with member this.abc() = 100 键入Microsoft.FSharp.Collections.List正确的语法是: type List<'a> with member this.abc() = 100 type List<'a> with member this.abc() = 100 module List = let ab

如何在F#列表上定义扩展方法

像这样天真的尝试会导致错误:

type list with
    member this.abc() = 100
键入Microsoft.FSharp.Collections.List正确的语法是:

type List<'a> with
    member this.abc() = 100
type List<'a> with
    member this.abc() = 100
module List = 
    let abc (xs: _ list) = 100