[racket] confused beginner

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat Oct 4 15:38:08 EDT 2014

Are you sure you have a recent version of racket? I wonder if you're
looking at the docs for the latest release (on docs.racket-lang.org)
but you have an older release where you're trying things out.

Note that you can look at your local docs and those docs should match
up to your local installation.

Robby


On Sat, Oct 4, 2014 at 2:32 PM, Andrew Ulrich
<andrewsotheraccount at gmail.com> wrote:
> Ok, I'm stuck again:
> I'm trying to use place-image, but it keeps saying
> place-images: unbound identifier in module in: place-images
>
> It doesn't even seem to work with the example code in the docs found at:
> http://docs.racket-lang.org/teachpack/2htdpimage.html?q=overlay#%28def._%28%28lib._2htdp%2Fimage..rkt%29._place-images%29%29
>
> Here's what I think the docs say the code is:
> #lang racket
> (require 2htdp/universe)
> (require 2htdp/image)
> (require lang/posn)
> (place-images
>    (list (circle 4 "solid" "blue")
>          (circle 4 "solid" "white")
>          (circle 4 "solid" "white")
>          (circle 4 "solid" "white"))
>    (list (make-posn 18 20)
>          (make-posn 0 6)
>          (make-posn 14 2)
>          (make-posn 8 14))
>    (rectangle 24 24 "solid" "goldenrod"))
>
> But like I said, I get the error.  I'm trying to use place-images to place a
> bunch of sprite images on a scene for a simple video game.  I'm assuming
> place-images the best way to do that.
>
> Thanks in advance for helping me out.  I know it's basic stuff.
>
> On Sat, Oct 4, 2014 at 9:04 AM, Andrew Ulrich
> <andrewsotheraccount at gmail.com> wrote:
>>
>> Aha, great! Thanks guys!
>>
>> Andrew
>>
>> On Sat, Oct 4, 2014 at 8:54 AM, Jens Axel Søgaard <jensaxel at soegaard.net>
>> wrote:
>>>
>>> Hi Andrew,
>>>
>>> To add what Matthias say, if you need a "function version" of bitmap,
>>> you can use bitmap/file instead.
>>>
>>>     (require 2htdp/image)
>>>     (define path-stringy "images/some.png")
>>>     (bitmap/file path-stringy)
>>>
>>> Note that I changed (path-stringy) to path-stringy.
>>>
>>> /Jens Axel
>>>
>>>
>>>
>>>
>>> 2014-10-04 15:48 GMT+02:00 Matthias Felleisen <matthias at ccs.neu.edu>:
>>> >
>>> > What you used is called a "computed string" that is, you expect bitmap
>>> > to evaluate the argument path-stringy to a string.
>>> >
>>> > But, in BSL, bitmap expects to be handed a literal string constant (or
>>> > a module path):
>>> >
>>> > ---------------------------------------------------------------------
>>> > (require 2htdp/image)
>>> >
>>> > ;; with a module path
>>> > (bitmap 2htdp/planetcute/character-cat-girl.png)
>>> >
>>> > ;; with a fixed string
>>> > (bitmap
>>> > "plt/pkgs/htdp-pkgs/htdp-lib/2htdp/planetcute/character-cat-girl.png")
>>> > ---------------------------------------------------------------------
>>> >
>>> > Both of these will succeed and retrieve the cat girl from the Planet
>>> > Cute collection that comes with Racket -- Matthias
>>> >
>>> >
>>> >
>>> >
>>> > On Oct 4, 2014, at 9:36 AM, Andrew Ulrich wrote:
>>> >
>>> >> Hi, I've got a really simple problem, I think.  Why is it that when I
>>> >> try to do the following:
>>> >>
>>> >> (require 2htdp/image)
>>> >> (define path-stringy "images/some.png")
>>> >> (bitmap (path-stringy))
>>> >>
>>> >> I get the following error:
>>> >>  bitmap: expected the argument to specify a local path (via a string)
>>> >> or a module path (e.g. `icons/b-run.png') in: (bitmap (path-stringy))
>>> >>
>>> >> I mean, shouldn't path-stringy evaluate to a string before it's passed
>>> >> into bitmap?  If not, then how do I use bitmap for anything dynamic?
>>> >>
>>> >> Thanks,
>>> >> Andrew
>>> >> ____________________
>>> >>  Racket Users list:
>>> >>  http://lists.racket-lang.org/users
>>> >
>>> >
>>> > ____________________
>>> >   Racket Users list:
>>> >   http://lists.racket-lang.org/users
>>>
>>>
>>>
>>> --
>>> --
>>> Jens Axel Søgaard
>>
>>
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>


Posted on the users mailing list.