Function Application Operator ($) in F#?

前端 未结 1 1503
孤街浪徒
孤街浪徒 2020-12-07 01:05

Let\'s say I have this code

let identifier = spaces_surrounded (many1Satisfy isLetter)

I was wondering if it there was any native F# functi

相关标签:
1条回答
  • 2020-12-07 01:33

    The standard F# idiom for this is the forward pipe operator |> were you would rewrite

    let identifier = spaces_surrounded (many1Satisfy isLetter)
    

    as

    let identifier = many1Satisfy isLetter |> spaces_surrounded 
    

    you can also use the backward pipe operator <| if you want to maintain the original order, but this tends to be a little less common

    let identifier = spaces_surrounded <| many1Satisfy isLetter
    
    0 讨论(0)
提交回复
热议问题