Syntax 在F#中以无点样式匹配?

Syntax 在F#中以无点样式匹配?,syntax,f#,pattern-matching,pointfree,Syntax,F#,Pattern Matching,Pointfree,考虑以下代码: type Fruit = Apple | Banana let totalCost fruits = fruits |> Seq.map (fun fruit -> match fruit with | Apple -> 0.50 | Banana -> 0.70 ) |> Seq.sum 我是否可以将totalCost重写得更简洁一些,以便删除水果标识符 大概是这样的: // Not real cod

考虑以下代码:

type Fruit = Apple | Banana

let totalCost fruits = 
  fruits
  |> Seq.map (fun fruit -> 
    match fruit with
    | Apple -> 0.50
    | Banana -> 0.70
  )
  |> Seq.sum
我是否可以将
totalCost
重写得更简洁一些,以便删除
水果
标识符

大概是这样的:

// Not real code
let totalCost fruits = 
  fruits
  |> Seq.map (
    match
    | Apple -> 0.50
    | Banana -> 0.70
  )
  |> Seq.sum

您要查找的关键字是
function

|> Seq.map ( 
    function
    | Apple -> 0.50 
    | Banana -> 0.70
)

function
被删除为
fun x->match x with

您要查找的关键字是
function

|> Seq.map ( 
    function
    | Apple -> 0.50 
    | Banana -> 0.70
)

函数
被删除为
fun x->match x with

挑剔:
水果
是一个标识符,而不是关键字。关键词是具有特殊语法意义的词,如
类型
乐趣
匹配
@glennsl Good catch。固定的挑剔:
水果
是一个标识符,而不是关键字。关键词是具有特殊语法意义的词,如
类型
乐趣
匹配
@glennsl Good catch。固定的