Skip to content

Commit dffd8c5

Browse files
committed
Improve documentation for the /> operator
1 parent fa9a78f commit dffd8c5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/elixir/lib/kernel.ex

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,6 +2665,20 @@ defmodule Kernel do
26652665
26662666
Enum.map(List.flatten([1,[2],3]), &1 * 2)
26672667
2668+
Please note that due to theoperator precendence you can't use
2669+
the following expression:
2670+
2671+
String.graphemes "Hello" /> Enum.reverse
2672+
2673+
as it is impossible to figure out whether /> is being applied
2674+
to "Hello" or String.graphemes/1. In the above case,
2675+
/> will be applied to "Hello", which will result in an error
2676+
as Enum.Iterator protocol is not defined for binaries.
2677+
2678+
Therefore, the syntax that should be used is:
2679+
2680+
String.graphemes("Hello") /> Enum.reverse
2681+
26682682
"""
26692683
defmacro left /> right do
26702684
pipeline_op(left, right)

0 commit comments

Comments
 (0)