Skip to content
Browse files

Improve documentation for the /> operator

  • Loading branch information...
1 parent fa9a78f commit dffd8c59ad147b27ce6f618cf64f7663330abcfc @yrashk yrashk committed Dec 3, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 lib/elixir/lib/kernel.ex
View
14 lib/elixir/lib/kernel.ex
@@ -2665,6 +2665,20 @@ defmodule Kernel do
Enum.map(List.flatten([1,[2],3]), &1 * 2)
+ Please note that due to theoperator precendence you can't use
+ the following expression:
+
+ String.graphemes "Hello" /> Enum.reverse
+
+ as it is impossible to figure out whether /> is being applied
+ to "Hello" or String.graphemes/1. In the above case,
+ /> will be applied to "Hello", which will result in an error
+ as Enum.Iterator protocol is not defined for binaries.
+
+ Therefore, the syntax that should be used is:
+
+ String.graphemes("Hello") /> Enum.reverse
+
"""
defmacro left /> right do
pipeline_op(left, right)

0 comments on commit dffd8c5

Please sign in to comment.
Something went wrong with that request. Please try again.