<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Of course. use list comprehensions! or?<div><br></div><div>This is kind of fun. Check the generated beam code for this module (using R16B02 right now)</div><div><br></div><div><div>-module(compcase).</div><div>-compile(export_all).</div><div>-compile(inline).</div><div>-compile({inline_size, 100}).</div><div>-compile({inline_unroll, 2}).</div><div><br></div><div>f(X,Y) -></div><div> [A] = [case {X,Y} of </div><div><span class="Apple-tab-span" style="white-space:pre"> </span> {0,Q} -> Q; </div><div><span class="Apple-tab-span" style="white-space:pre"> </span> {P,Q} -> P+Q </div><div><span class="Apple-tab-span" style="white-space:pre"> </span> end || _ <- [[]]],</div><div> [B] = [case {X,Y} of </div><div><span class="Apple-tab-span" style="white-space:pre"> </span> {0,Q} -> Q; </div><div><span class="Apple-tab-span" style="white-space:pre"> </span> {P,Q} -> P*Q </div><div><span class="Apple-tab-span" style="white-space:pre"> </span> end || _ <- [[]]],</div><div> {A,B}.</div><div><br></div><div><br></div><div>g(X,Y) -></div><div> A = fun({0,Q}) -> Q; </div><div><span class="Apple-tab-span" style="white-space:pre"> </span> ({P,Q}) -> P+Q </div><div><span class="Apple-tab-span" style="white-space:pre"> </span> end({X,Y}),</div><div> B = fun({0,Q}) -> Q; </div><div><span class="Apple-tab-span" style="white-space:pre"> </span> ({P,Q}) -> P*Q</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>end({X,Y}),</div><div> {A,B}.</div></div><div><br></div><div><br></div><div><br><div><br><div><div>On 4 mar 2014, at 23:27, Anthony Ramine <<a href="mailto:n.oxyde@gmail.com">n.oxyde@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Note that there is also one scope per generator input, which does not spill into the generator pattern nor the rest of the comprehension.<br><br>-- <br>Anthony Ramine<br><br>Le 4 mars 2014 à 22:49, Richard A. O'Keefe <<a href="mailto:ok@cs.otago.ac.nz">ok@cs.otago.ac.nz</a>> a écrit :<br><br><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre"> </span>- a list comprehension is a scope<br></blockquote><br>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://erlang.org/mailman/listinfo/erlang-questions<br></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 12px; ">"Installing applications can lead to corruption over time. </span><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 12px; ">Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix"</span></div><div><span class="Apple-style-span" style="color: rgb(51, 51, 51); font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 12px; "><br></span></div></span><br class="Apple-interchange-newline">
</div>
<br></div></div></body></html>