[plt-scheme] problem

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Aug 26 08:00:57 EDT 2008


Mike Aneward, Sky gave you the correct answer to your specific question.


I do recommend that instead of using the draw.ss teachpack and  
working your way your HtDP,
take a look at

  http://www.ccs.neu.edu/home/matthias/HtDP/Prologue/book.html

read it, and use real images in drscheme together with the world.ss  
teachpack.
Do the book exercises that don't involve drawing and otherwise look  
at the material
linked to the above site for "drawing" exercises.

-- Matthias









On Aug 26, 2008, at 12:03 AM, Sky O'Mara wrote:

> As far as I know, there shouldn't be a problem with using a  
> structure within another structure. In what way is it not working?
>
> Here's an example of using a posn inside another structure:
> (define-struct foo (a))
> (define my-foo (make-foo (make-posn 1 2)))
> (foo-a my-foo) ;; -> (make-posn 1 2)
> (posn-x (foo-a my-foo)) ;; -> 1
>
> - Sky O.
>
> On Aug 25, 2008, at 7:33 PM, mike wrote:
>
>> I'm presently working through the exercises and have a question about
>> 6.6.1;
>> it concerns making a structure definition for circle and i simply did
>> by
>> (define-struct circface (x y radius color))
>> and was able to draw the circle by:
>> (define (draw-a-circle a-circface)
>>  (draw-circle (make-posn (circface-x a-circface) (circface-y a-
>> circface))
>>                          (circface-radius a-circface) (circface-color
>> a-circface)))
>> What i tried to do initially was to define the circle structure by
>> imbedding
>> a posn structure within the definition but it just did not seem to
>> work. So
>> my question is: can you imbed a data structure within a new data
>> structure
>> definition? If so can i have a small hint?
>> oh example of circle structure used for drawing was defined by:
>> (define example1 (make-circface 100 100 50 'red))
>> thanks for any input
>> mike
>> _________________________________________________
>>  For list-related administrative tasks:
>>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.