F# 中的函数应用运算符 ($)?
假设我有这段代码,
let identifier = spaces_surrounded (many1Satisfy isLetter)
我想知道是否有任何本机 F# 函数允许我将其重构为
let identifier = spaces_surrounded $ many1Satisfy isLetter
诸如此类的东西
let ($) f1 f2 = f1 (f2)
(如果我没有记错的话,我的 Haskell 技能不太敏锐..)。
Let's say I have this code
let identifier = spaces_surrounded (many1Satisfy isLetter)
I was wondering if it there was any native F# function that allowed me to refactor it to
let identifier = spaces_surrounded $ many1Satisfy isLetter
that is, something such as
let ($) f1 f2 = f1 (f2)
(that is if I am not mistaken, my Haskell skills are not too sharp..).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
标准的 F# 习惯用法是前向管道运算符
|>
(如果您要重写的话),因为
您也可以使用后向管道运算符
<|
(如果您想保持原始订单,但这往往不太常见The standard F# idiom for this is the forward pipe operator
|>
were you would rewriteas
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