abitdodgy
What prevents us from piping to arithmetic operators?
I’m aware that you can use Kernel to pipe with arithmetic operators. But why do we have to? Is it a style concern, or a compiler limitation that stops us from doing: 5 |> +(2)?
Most Liked
blatyo
Conduit Core Team
I believe it conflicts with the unary + operator, which has a higher precedence than |>.
x = quote do: 5 |> +(2)
# {:|>, [context: Elixir, import: Kernel],
# [5, {:+, [context: Elixir, import: Kernel], [2]}]}
x |> Macro.expand(__ENV__) |> Macro.to_string() |> Macro.format_string!()
# warning: piping into a unary operator is deprecated, please use the qualified name. For example, Kernel.+(5), instead of +5
# ** (ArgumentError) cannot pipe 5 into +2, the :+ operator can only take two arguments
That argument error, seems to have an error in its statement though. I suspect it was allowed at some point and became disallowed because of precedence/parsing issues.
4
Popular in Discussions
It seems that the more I read, the more I find Elixir users speaking about all the ways that Elixir is not good for x, y, and z use cases...
New
This is an interesting article to read. Elixir’s performance, like usual, is excellent. However, it seems like the high CPU usage is co...
New
After doing a port from a c++ library to my project in phoenix I’ve seen that I need a faster way to run this algorithm and I found this ...
New
Just saw that dhh announced https://hotwire.dev/
Is it just me or is this essentially live view? :smiley:
Although I like the “iFrame-e...
New
Let me start by stating an assumption: Phoenix is a great approach to building REST APIs. There are many reasons for this, but I will ass...
New
Hey everyone,
this has been brewing in my head some time and it came up again while reading Adopting Elixir.
GenServers, supervisors et...
New
Are there any downsides, like perf issues, to putting all functional components in CoreComponents as long as you prefix it with the conte...
New
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
New
I like Umbrella projects and pretty much always use them for personal Elixir stuff, especially Nerves things.
But I don’t think this is ...
New
Other popular topics
lets say i have a sample like
a = 20; b = 10;
if (a > b) do
{:ok, "a"}
end
if (a < b) do
{:ok, b}
end
if (a == b) do
{:ok, "equa...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set?
Thanks.
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New
I have VueJS GUIs with the project generated using Webpack.
I have Elixir modules that will need to be used by the VueJS GUIs.
I forese...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
Hello everyone,
Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
New
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









