[erlang-questions] List comprehension question
Tue May 27 15:25:54 CEST 2014
On Tue, May 27, 2014 at 8:15 AM, Fred Hebert <> wrote:
> On 05/22, Rich Neswold wrote:
> I don't know how many people already use this trick, but I thought it
> > of use to others.
> 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.
I agree that tricky and "cute" code should be avoided. The example was
illustrating the technique. My real-world code greatly simplified the
number of lines, so I felt it was a win. Even your first example, if
expanded, would require two case statements and some way to tie the
resulting values back into the list. The comprehension is much cleaner.
Thanks for the feedback and for your examples!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions