有没有办法提取成员函数,并将它们用作 F# 函数?我希望能够编写以下内容:
mystring |> string.Split '\n' |> Array.filter (string.Length >> (=) 0 >> not)
如果你 [让] 上面的代码有效
let mystring = "a c\nb\n"
let stringSplit (y:char) (x:string) = x.Split(y)
let stringLength (x:string) = x.Length
mystring |> stringSplit '\n' |> Array.filter (stringLength >> (=) 0 >> not)