Think that would be a good idea

> On Sep 23, 2018, at 07:58, [email protected] wrote:
> 
> That is even better. Thanks for the tip. 
> 
> What about adding a section "Pasting into iex" to 
> https://hexdocs.pm/iex/IEx.html?
> 
> 
>> On Sunday, September 23, 2018 at 4:31:27 PM UTC+2, Wojtek Mach wrote:
>> 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.
>>> 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/c0badbf0-ce48-4df3-883c-ade464a3793e%40googlegroups.com.
> 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/AAC61C5F-D66C-4C53-B6C8-D4E79FED0C40%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to