s c h e m a t i c s : c o o k b o o k

/ WebHome / CookbookBrainStorm / Cookbook.StructureRecipes

This Web


WebHome 
WebChanges 
TOC (with recipes)
NewRecipe 
WebTopicList 
WebStatistics 

Other Webs


Chicken
Cookbook
Erlang
Know
Main
Plugins
Sandbox
Scm
TWiki  

Schematics


Schematics Home
Sourceforge Page
SchemeWiki.org
Original Cookbook
RSS

Scheme Links


Schemers.org
Scheme FAQ
R5RS
SRFIs
Scheme Cross Reference
PLT Scheme SISC
Scheme48 SCM
MIT Scheme scsh
JScheme Kawa
Chicken Guile
Bigloo Tiny
Gambit LispMe
GaucheChez

Lambda the Ultimate
TWiki.org

Structures

Introduction

Structures are the built in records in PLT. SRFI9 provides portable records.

A stucture type is a record datatype with a number of fields. A structure is an instance of a given structure type. Structures are first class values that contain a value for each field of the the structure type.

;; Small usage example

> (define-struct user (name password))
> (define guest (make-user "Anonymous" "1234")
> (user? guest)
#t
> (user-name guest)
"Anonymous"
> (set-user-name! guest "Guest")
> (user-name guest)
"Guest"

See Structures - Chapter 4 in the MzScheme documentation for a thorough explanation of the use of structures.

References

Structures - Chapter 4 in the MzScheme documentation

Reading and Writing Structures

-- JensAxelSoegaard - 04 Jun 2004

CookbookForm
TopicType: Chapter
ParentTopic: TOC
TopicOrder: 05

 
 
Copyright © 2004 by the contributing authors. All material on the Schematics Cookbook web site is the property of the contributing authors.
The copyright for certain compilations of material taken from this website is held by the SchematicsEditorsGroup - see ContributorAgreement & LGPL.
Other than such compilations, this material can be redistributed and/or modified under the terms of the GNU Lesser General Public License (LGPL), version 2.1, as published by the Free Software Foundation.
Ideas, requests, problems regarding Schematics Cookbook? Send feedback.
/ You are Main.guest