[erlang-questions] List comprehension question

Fred Hebert mononcqc@REDACTED
Tue May 27 15:15:53 CEST 2014

On 05/22, Rich Neswold wrote:
> On Thu, Jan 16, 2014 at 10:39 AM, Rich Neswold <rich.neswold@REDACTED>
> wrote:
> However, I can do this:
> [{{S, NC}, SF} || {S, C} <- Reqs,
>                   {value, {NC, SF}} <- [gb_trees:lookup({S, C}, T)]]
> Wrap the function in a single element array and now you have a generator!
> Now I can add more filters or more generators to it.
> I don't know how many people already use this trick, but I thought it might
> of use to others.
> -- 
> Rich

I used this form before in libraries like bertconf:


My experience has been that it has caused more confusion in readers than
anything, and I have since then tried to keep that stuff to the strict
minimum usage possible.

It's a neat trick, but tricks tend to surprise people.


More information about the erlang-questions mailing list