[racket] printf: this function is not defined

From: Geoffrey Boom (geoff.the.boom at gmail.com)
Date: Sun Dec 9 16:48:10 EST 2012

oh silly me. I found the racket guide i was using before at
http://www.ccs.neu.edu/home/matthias/HtDP2e/part_prologue.html
The other problem still stands though,

On Sun, Dec 9, 2012 at 4:40 PM, Geoffrey Boom <geoff.the.boom at gmail.com>wrote:

> 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.
>
> That's not my main problem, though. I'm at the section that goes like this:
>
> 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.
>
> Examples:
> (define (bake flavor)
>   (printf "pre-heating oven...\n")
>   (string-append flavor " pie"))
> > (bake "apple")
> pre-heating oven...
> "apple pie"
>
> Here's everything I've entered so far.
>
> (define (extract str)
>   (substring str 4 7))
>
>
> (extract "the boy out of the country")
> (extract "the country out of the boy")
>
> (define (bake flavor)
>   (printf "preheating oven..\n")
>   (string-append flavor " pie"))
>
> (bake "apple")
>
> and I get the error message
>
> define: expected only one expression for the function body, but found 1
> extra part
>
> So I try taking out (string-append flavor " pie") and get a second error
> message
>
> printf: this function is not defined
>
>
> 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.
>
> I tried entering *just* what the guide said to enter, as in copy pasting
> it in, but still get the same problems.
>
> Any help? :(
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121209/20078925/attachment.html>

Posted on the users mailing list.