<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<br><div><div>On Sep 16, 2011, at 11:52 AM, Shriram Krishnamurthi wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I introduced templates today.<span class="Apple-converted-space">&nbsp; </span>Almost as if on cue, one student asked</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">whether he could use else instead of (cons?<span class="Apple-converted-space">&nbsp; </span>l).<span class="Apple-converted-space">&nbsp; </span>I told them I was</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">going to make a MORAL judgment about why it was EVIL, and spent ten</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">minutes talking about all that.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">As class ended, one of my students came up and said,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">"So why doesn't the Racket language Web site agree with you?"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://docs.racket-lang.org/guide/Lists__Iteration__and_Recursion.html">http://docs.racket-lang.org/guide/Lists__Iteration__and_Recursion.html</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">(Look for "[else".)</div></blockquote><div><br></div>Interesting.</div><div><br></div><div>I'm with you: I tell my students to use "else" to capture true "none of the above" cases that can't easily be described directly, e.g.</div><div><br></div><div>(define (size thing)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>(cond [(string? thing) (string-length thing)]</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>&nbsp;&nbsp; [(real? thing) (abs thing)]</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>&nbsp;&nbsp; [(image? thing) (* (image-width thing) (image-height thing))]</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>&nbsp;&nbsp; [else (error 'size "I don't know how to handle that type.")]))</div><div><br></div><br><br><div> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div>Stephen Bloch</div><div><a href="mailto:sbloch@adelphi.edu">sbloch@adelphi.edu</a></div><div><br class="webkit-block-placeholder"></div></span><br class="Apple-interchange-newline"> </div><br></body></html>