“ |”是什么意思?在e剂中意味着什么? [英] What does "|>" mean in elixir?

查看:195
本文介绍了“ |”是什么意思?在e剂中意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读github上的一些代码长生不老药代码,并且看到 |> 经常被使用。它没有出现在文档站点上的操作的列表中。这是什么意思?



  expires_at:std [ expires_in] |> ; expires_at,


解决方案

这是管道运算符。从链接的文档中:


此运算符在左侧引入表达式,作为右侧函数调用的第一个参数。 / p>

示例


iex> [1,[2],3] |> List.flatten()


[1、2、3]


上面的示例与调用 List.flatten([1,[2],3])相同。



I'm reading through some code elixir code on github and I see |> being used often. It does not appear in the list of operation on the documentation site. What does it mean?

i.e.

expires_at:    std["expires_in"] |> expires_at,

解决方案

This is the pipe operator. From the linked docs:

This operator introduces the expression on the left-hand side as the first argument to the function call on the right-hand side.

Examples

iex> [1, [2], 3] |> List.flatten()

[1, 2, 3]

The example above is the same as calling List.flatten([1, [2], 3]).

这篇关于“ |”是什么意思?在e剂中意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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