[plt-scheme] examining structures, data definitions (ch6 HtDp)
On Tuesday, February 10, 2004, at 03:38 AM, Terrence Brannon wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> I just finished the chapter on compound data and have a few questions:
>
> (1) how can I examine a structure's components, ie:
>
> scheme> (inspect posn)
> DOCS: a structure designed to hold cartesian coordinates
> STRUCTURE:
> (
> x
> y
>
> )
You "ctrl click" on "posn" and get this in HelpDesk:
Beginning Student Language
posn? in "posn?"
posn-y in "posn-y"
posn-x in "posn-x"
make-posn in "make-posn"
You can then use the hyperlinks to see what they do.
> (2) the chapter said that data definitions were a mix of Scheme and
> English. Is there no way to create typed structures that require
> arguments of a certain type?
No. Not yet, I should say.
You should looke at section 7, input errors, if you're a beginner. Or,
if you have significant experience,
look for module and provide/contract.
-- Matthias