<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 27, 2014 at 8:15 AM, Fred Hebert <span dir="ltr"><<a href="mailto:mononcqc@ferd.ca" target="_blank">mononcqc@ferd.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 05/22, Rich Neswold wrote: </div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">> I don't know how many people already use this trick, but I thought it might<br></div><div class="">
> of use to others.<br><br>
</div>I used this form before in libraries like bertconf:<br>
<br>
<a href="https://github.com/ferd/bertconf/blob/master/src/bertconf_bert_loader.erl#L50-L52" target="_blank">https://github.com/ferd/bertconf/blob/master/src/bertconf_bert_loader.erl#L50-L52</a><br>
<a href="https://github.com/ferd/bertconf/blob/master/src/bertconf_bert_loader.erl#L93-L94" target="_blank">https://github.com/ferd/bertconf/blob/master/src/bertconf_bert_loader.erl#L93-L94</a><br>
<br>
My experience has been that it has caused more confusion in readers than<br>
anything, and I have since then tried to keep that stuff to the strict<br>
minimum usage possible.<br>
<br>
It's a neat trick, but tricks tend to surprise people.<br></blockquote></div><br clear="all"><div>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.</div>
<div><br></div><div>Thanks for the feedback and for your examples!</div><div><br></div>-- <br>Rich<br>
</div></div>