2thdp/image isn't effectful; images are values. You need to combine the
image you get from rendering one bear with the image you get from rendering
the rest of the list. You can do so using one of the combiners provided by
the library:

(combiner-of-choice (render-bear (first bears))
                                 (render-bears (rest bears)))

(possibly with some extra arguments thrown in)

- Sam Caldwell

On Wed, Mar 22, 2017 at 3:45 PM, Angus <anguscom...@gmail.com> wrote:

> I am a bit stuck on rendering images in a list.
>
> Here is my code below.
>
> (require 2htdp/image)
>
> (define-struct bear-state (x y rotation size))
>
> (define MTS (empty-scene WIDTH HEIGHT))
>
> BEAR-IMAGE is just a graphic - of a bear.
>
> (define (render-bear b)
>   (place-image (scale (bear-state-size b) (rotate (bear-state-rotation b)
> BEAR-IMAGE))  (bear-state-x b) (bear-state-y b) MTS))
>
>
>
> (define (render-bears bears)
>   (cond [(empty? bears) (place-image (square 0 "outline" "white") 0 0 MTS)]
>         [else
>           (render-bear (first bears))       ; can render 1 bear
>                          (render-bears (rest bears))]))
>
>
> render-bear works but I can't get render-bears to work.  What am I doing
> wrong? Any hints?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to