[plt-scheme] Defining structures
define-struct does not define a struct, it defines a struct-type and a number of related procedures, such as a constructor (make-...), a predicate ...? and accessors and mutators.
make-struct-... is a procedure that returns an instantiation of the struct-type.
I think `define-struct-type' would be a better name, but reality is different.
Personally I prefer make-struct-type, but that is not in the teaching languages, I think.
Jos
----- Original Message -----
From: aditya shukla
To: PLT Scheme ML
Sent: Wednesday, February 18, 2009 2:43 AM
Subject: [plt-scheme] Defining structures
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))
Now a few lines later it says If we give the structure a name,(define phonebook (make-entry 'PeterLee 15270 '606-7771))
Now my question here is phonebook the name of the structure or it is a structure of type entry?
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/20090218/765d13fc/attachment.html>