<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>I wrote:</div><blockquote type="cite"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">"to-play" MIGHT be a good way to do things, but in many cases (including the above "accelerate" example) it'll be more natural to specify a sound as you determine the new world, rather than as a separate function of the state of the world.<span class="Apple-converted-space"> </span>It's analogous to the difference between "stop-when" and "stop-with".<span class="Apple-converted-space"> </span>One could provide this ability very simply:</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; ">(define (play-with sound world)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-converted-space"> </span>(begin (play sound) world))</div></blockquote></blockquote><div><br></div><div>On Oct 20, 2011, at 2:27 PM, John Clements replied:</div><div><br></div><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Yes, but how do you write test cases for this?</div></blockquote><br></div><div>Good question. How do you write test cases for "play"?</div><div><br></div><div>At some point you inevitably move from returning values to outputting them somehow, and they become much more difficult to test. For text output, we can capture it to a string, but test cases for sound may need to be human-checked.</div><br><div><br></div><div>It occurs to me that a few months ago, when I was porting one of my colleagues' students' "game programming" final project to Racket, I used the "play-sound" function from racket/gui/base in a world program. It worked, but I wasn't trying to do anything complicated with it.</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>