[plt-scheme] Defining structures

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Feb 17 21:04:23 EST 2009

On Feb 17, 2009, at 8:43 PM, aditya shukla wrote:

> I have a doubt the concept of defining structures.In htdp chapter  
> 6  its given as
>
> A STRUCTURE DEFINITION is, as the term says, a new form of  
> definition. Here is DrScheme's definition of posn: i have modified  
> the example here
>
> (define-struct entry (name zip phone))

A __structure definition__ adds a class of values (lots and lots of  
them) to the ever-expanding universe of values.

> Now a few lines later it says
>
>
> If we give the structure a name,
>
> (define phonebook (make-entry 'PeterLee 15270 '606-7771))

A __structure instance__ is a specific value from the class of values  
that some structure definition added to the universe.

Here you gave it a name: phonebook (a horrible name, because you're  
dealing with just one person).

-- Matthias

> Now my question here is  phonebook the name of the structure  or it  
> is a structure of type entry?

The name _phonebook_ stands for the value (make-entry ...). To which  
class of values does it belong?



>
>
> Aditya
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090217/6001f4eb/attachment.html>

Posted on the users mailing list.