是否记录了双向前/后管道操作员?

Dan*_*iel 7 f#

我记得读过双管操作符 - ||>和<|| - 在某个地方,现在我不记得在哪里.我在MSDN或语言规范中找不到它们.他们在任何地方记录?

let print a b = sprintf "%O %O" a b
(1, 2) ||> print
// val it : string = "1 2"
Run Code Online (Sandbox Code Playgroud)

Tom*_*cek 6

双(前向/后向)管道运算符记录在MSDN上F#运算符列表中,并且还记录为从Core.Operators模块导出的函数.

这可能是从F#源中的XML文档自动生成的,因此这些页面有一些神秘的名称:

作为旁注,使用搜索引擎找到运营商是一个问题,所以我查看了F#源(与CTP版本一起分发),其中prim-types.fs包括以下内容:

/// <summary>Apply a function to two values, the 
///   values being a pair on the left, the function on the right</summary>
/// <param name="arg1">The first argument.</param>
/// <param name="arg2">The second argument.</param>
/// <param name="func">The function.</param>
/// <returns>The function result.</returns>
val inline (||>): arg1:'T1 * arg2:'T2 -> func:('T1 -> 'T2 -> 'U) -> 'U
Run Code Online (Sandbox Code Playgroud)

我打算推荐F#来源作为这种事情的好文档(他们当然是这样),但后来我将<summary>标签的一部分粘贴到谷歌并找到了上面提到的页面:-).