Make sure you're using<div><br></div><div>#lang racket</div><div><br></div><div>declared at the top of your source code and have chosen the appropriate radio button from the Choose Language... menu. It sounds like you're stuck in one of the teaching languages.<br>
<br><div class="gmail_quote">On Sun, Dec 9, 2012 at 4:40 PM, Geoffrey Boom <span dir="ltr"><<a href="mailto:geoff.the.boom@gmail.com" target="_blank">geoff.the.boom@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm having trouble with the racket guide. First of all, I havent used it in a little while, so I was surprised when I looked for the guide, and I think it's new, and I can't find the old one. <br><br>That's not my main problem, though. I'm at the section that goes like this:<br>
<span style="color:rgb(0,153,0)"><br></span><div><font color="#009900">A function definition can include multiple expressions for the function’s body. In that case, only the value of the last expression is returned when the function is called. The other expressions are evaluated only for some side-effect, such as printing.<br>
<br>Examples:<br>(define (bake flavor)<br> (printf "pre-heating oven...\n")<br> (string-append flavor " pie"))<br>> (bake "apple")<br>pre-heating oven...<br>"apple pie"</font><div>
<br>Here's everything I've entered so far.<br><div><br><div><font color="#009900">(define (extract str)</font></div><div><font color="#009900"> (substring str 4 7))</font></div><div><font color="#009900"><br></font></div>
<div><font color="#009900"><br></font></div><div><font color="#009900">(extract "the boy out of the country")</font></div><div><font color="#009900">(extract "the country out of the boy")</font></div>
<div>
<font color="#009900"><br></font></div><div><font color="#009900">(define (bake flavor)</font></div><div><font color="#009900"> (printf "preheating oven..\n")</font></div><div><font color="#009900"> (string-append flavor " pie"))</font></div>
<div><font color="#009900"><br></font></div><div><font color="#009900">(bake "apple")</font></div><div><font color="#009900"><br></font></div><div>and I get the error message </div><div><font color="#009900"><br>
</font></div><div><font color="#990000">define: expected only one expression for the function body, but found 1 extra part</font></div><div><font color="#990000"><br></font></div><div>So I try taking out (string-append flavor " pie") and get a second error message </div>
<div><br></div><div><font color="#990000" style>printf: this function is not defined</font></div><div><br></div><div><br></div><div><span style>I understand that define expects two sections after it (the name it defines and the definition it enters when triggered) so in this case the "string-append" would be the one extra. But I dont understand why the "printf" thing doesn't work. Nor do I know what the "printf" function does, as it's not explained in the guide.</span></div>
<div><span style><br></span></div><div><span style>I tried entering *just* what the guide said to enter, as in copy pasting it in, but still get the same problems.</span></div>
<div><span style><br></span></div><div><span style>Any help? :(</span></div><div><br></div></div></div></div>
<br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>