<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 5, 2014 at 4:55 AM, Dimitri DeFigueiredo <span dir="ltr"><<a href="mailto:defigueiredo@ucdavis.edu" target="_blank">defigueiredo@ucdavis.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div id=":1bl" class="" style="overflow:hidden">
For comparison, could you also translate the inefficient version of plast<br>
into the case notation you use above?</div></blockquote></div><br></div><div class="gmail_extra">You probably already know this already, but it's worth underscoring for everyone that it's not the translation into case notation /per se/ that gives you the incremental performance improvement.<br>

</div><div class="gmail_extra"><br></div><div class="gmail_extra">A function definition by parts is syntactic sugar for a single case expression.<br><br></div><div class="gmail_extra">All syntactic sugar, including others like do-notation, where clauses, etc., gets eliminated at the earliest stages when code is handed off to ghc.<br>

<br></div><div class="gmail_extra">I encourage newcomers to familiarize themselves with desugaring to avoid unpleasant surprises. The sugared syntax often suggests mystery and magic when there's really nothing of that sort at all.<br>

<br></div><div class="gmail_extra">Coming back to the topic of function definition by parts, aka piecewise definition, it appears that at least one reputable school thinks it's "weird" and "confusing" enough to be warrant a ban in homework:<br>

<br><a href="http://www.reddit.com/r/haskell/comments/223fi4/need_help/cgiywxi">http://www.reddit.com/r/haskell/comments/223fi4/need_help/cgiywxi</a><br></div><div class="gmail_extra"><br clear="all"><div>-- Kim-Ee</div>

</div></div>