Hi Tom! While it will not be added to core there is no reason why you couldn't implement this functionality in your application or as a library.
Elixir does allow custom operators, though the ones you can use is limited so you won't be able to use `||>` `|||>` etc. Perhaps instead your macro could use a placeholder to indicate where the value should be inserted: data |> File.write!(path, _) or data >>> File.write!(path, _) Cheers, Louis On Sun, 10 Mar 2019 at 09:45 José Valim <[email protected]> wrote: > Hi Tom, > > Extensions to the pipe operator have been proposed multiple times and > always rejected. I recommend reading previous discussions for more > information. > > Have a good one, > > > *José Valim* > www.plataformatec.com.br > Skype: jv.ptec > Founder and Director of R&D > > > On Sun, Mar 10, 2019 at 10:37 AM <[email protected]> wrote: > >> The pipeline operator is one of the best features of the language, >> however there are some instances where you want to continue a chain of >> pipelines for clarity but can't because the argument order is not conducive >> to piping. For example here is an example when working with files: >> >> defmodule Chess.PGN do >> def unique_checkmates(input_path, output_path) >> path >> |> File.stream!() >> |> Stream.chunk_every(21) >> |> Stream.filter(fn chunk -> checkmate?(Enum.at(chunk, 17)) end) >> |> Stream.uniq_by(fn chunk -> Enum.at(chunk, 19) end) >> |> Stream.map(fn chunk -> Enum.join(chunk, "") end) >> |> Enum.join("") >> |> write_file(output_path) >> end >> >> def write_file(content, output_path) do >> File.write!(output_path, content) >> end >> end >> >> Instead of having to add a dummy method I would like to double pipe into >> File.write which would be cleaner. >> >> ... >> ||> File.write!(output_path) >> >> I think this could also be extended to triple, and quadruple pipes. Five >> seems like overkill, but I think you could make the argument for arbitrary >> levels of piping. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "elixir-lang-core" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/elixir-lang-core/c6f02f27-fca4-4d5b-9c88-e966faaf9c0c%40googlegroups.com >> <https://groups.google.com/d/msgid/elixir-lang-core/c6f02f27-fca4-4d5b-9c88-e966faaf9c0c%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BVArZWX%3DBjnU%3DvB5ZZ8%2Bwk8_Ff2MqL8nG7_sjbQRheig%40mail.gmail.com > <https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4%2BVArZWX%3DBjnU%3DvB5ZZ8%2Bwk8_Ff2MqL8nG7_sjbQRheig%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CABu8xFBh_RrNCTjBPNyaDPj7Uw3xX3uhFYNssynemb%3D8Qg5tww%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
