We can achieve the same thing today with wrapping pipeline in `(...)`:

iex(1)> (
...(1)> 1..5
...(1)> |> Enum.map(fn x -> x + 1 end)
...(1)> )
[2, 3, 4, 5, 6]


niedz., 23 wrz 2018 o 16:23 <[email protected]> napisał(a):

> Hi all,
>
> I've recently stumbled across the .editor feature in Node.js' REPL. It
> sets the REPL in to editor mode, which allows for easily inputting (or
> pasting) multi-line code into the REPL.
> With iex, one of its shortcoming is its treatment of the pipe operator. If
> I want to paste code such as
>
> value
> |> fun1()
> |> fun2()
>
> into iex I must first rewrite it into
>
> value |> fun1() |> fun2()
>
> As the former is usually the preferred style of writing piped expressions,
> this means that whenever I want to try out code from a project that
> contains any such expression I must first manually reformat it. With a
> functionality such as the .editor mode this could be elegantly avoided.
>
> With the help of a macro this might be easily added, for example, as part
> of IEx.Helpers. If we had a macro `e` defined as
>
> defmacro e(do: block) do
>   quote do unquote(block) end
> end
>
> then `e` would become an editor mode like call in iex. For example, I
> could now write
>
> iex> e do
> ...> 1..5
> ...> |> Enum.map(fn x -> x + 1 end)
> ...> end
> [2,3,4,5,6]
>
> allowing me to easily paste more complex expressions including pipes in
> new lines into iex.
>
> Looking forward for feedback and comments.
>
> Regards
> Arno
>
>
>
>
> --
> 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/6611b3ce-0cbd-4e40-b212-a880e7a0f8ce%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/6611b3ce-0cbd-4e40-b212-a880e7a0f8ce%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Wojtek Mach

-- 
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/CADmQCno01pKbec8GCC5x%2B_X9dORWzmDbKrfbZY%3Daai_AWVmisg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to