[erlang-questions] Pipe Operator in Erlang?

Loïc Hoguin essen@REDACTED
Fri Jul 10 10:31:27 CEST 2015


:set/2 is a normal function, why wouldn't xref be able to work with it? 
Am I missing something?

On 07/10/2015 10:23 AM, Pierre Fenoll wrote:
> Loic: what's wrong is you can't xref it, AFAIK.
>
>
> Cheers,
> --
> Pierre Fenoll
>
>
> On 10 July 2015 at 01:15, Loïc Hoguin <essen@REDACTED
> <mailto:essen@REDACTED>> wrote:
>
>     On 07/10/2015 07:17 AM, Pierre Fenoll wrote:
>
>         A pipe operator would turn this structure-specific code into
>         something
>         more readable and editable too.
>         Maybe like something like this:
>
>               NewContext = Context
>                   |> cb_context:set_doc(_, [])
>                   |> cb_context:set_resp_status(_, success)
>                   |> cb_context:set_resp_data(_, [])
>                   |> cb_context:set_resp_etag(_, undefined)
>
>         Where m:f(_, A2) is fun (_1) -> m:f(_1, A2) end; thus redefining
>         _ for
>         pipes (in non-matching contexts…).
>
>
>     What's wrong with this?
>
>     NewContext = cb_context:set(#{doc=>[], resp_status=success...}, Context)
>
>     Has less repetition/verbosity, is most likely faster, already works
>     today, and you can also use a proplist if you're a map hater.
>
>
>     --
>     Loïc Hoguin
>     http://ninenines.eu
>     Author of The Erlanger Playbook,
>     A book about software development using Erlang
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>

-- 
Loïc Hoguin
http://ninenines.eu
Author of The Erlanger Playbook,
A book about software development using Erlang



More information about the erlang-questions mailing list