|>的名字是什么?在F#中,它有什么作用? [英] What is the name of |> in F# and what does it do?

查看:69
本文介绍了|>的名字是什么?在F#中,它有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个真正的F#新手问题,但是|>叫什么,它有什么作用?

A real F# noob question, but what is |> called and what does it do?

推荐答案

它称为

It's called the forward pipe operator. It pipes the result of one function to another.

Forward pipe运算符的简单定义为:

The Forward pipe operator is simply defined as:

let (|>) x f = f x

并具有类型签名:

'a -> ('a -> 'b) -> 'b

解析为:给定一个通用类型'a,然后使用一个函数'a'并返回'b,然后在输入上返回该函数的应用.

Which resolves to: given a generic type 'a, and a function which takes an 'a and returns a 'b, then return the application of the function on the input.

您可以在此处的文章中了解更多有关其工作原理的信息.

You can read more detail about how it works in an article here.

这篇关于|>的名字是什么?在F#中,它有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆