sihui_io
String interpolation with pipe
rest is [“a”] and last_gift is “b”.
rest |> Enum.join(", “) returns “a”, which is a string.
“a” |> “#{}, and #{last_gift}” returns “a, and b”.
But when I pipe them together, I get ArgumentError.
rest |> Enum.join(”, ") |> “#{}, and #{last_gift}”
** (ArgumentError) argument error
What do I miss? 
Most Liked
cantiero
This version looks ok IMO:
"test"
|> then(&"shmest #{&1}")
voltone
Right, so "234#{five}" is actually <<"234", five::binary>>, which is invoking Kernel.SpecialForms.<<>>. Piping something into that prepends the value at the front of that binary, if it is a legal parameter to <<>>.
So in the end "1" |> "234#{five}" expands to <<"1", "234", five::binary>> which happens to be legal. I don’t think it’s intentional.
sihui_io
It turns out a |> "#{}" doesn’t mean we are actually interpolating a into the position of #{}
iex(71)> "a" |> "This is: #{}, and #{last}"
"aThis is: , and b"
iex(72)> "a" |> "This is: , and #{last}"
"aThis is: , and b"







