Is it possible to use pipes in OCaml?

萝らか妹 提交于 2019-12-04 00:02:25
LiKao

These are available since OCaml 4.01. However, <| is named @@ there, so it has the correct operator associativity.

Alternatively, you can either define them yourself:

let (|>) v f = f v
let (<|) f v = f v  (* or: *)
let (@@) f v = f v

Or you use Ocaml batteries included, which has the |> and <| operators defined in BatStd.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!