[racket] confused beginner

From: Andrew Ulrich (andrewsotheraccount at gmail.com)
Date: Sat Oct 4 10:04:52 EDT 2014

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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141004/8a9d148d/attachment.html>

Posted on the users mailing list.