File: define-struct.html

package info (click to toggle)
drscheme 1%3A352-6
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 71,608 kB
  • ctags: 55,284
  • sloc: ansic: 278,966; cpp: 63,318; sh: 32,265; lisp: 14,530; asm: 7,327; makefile: 4,846; pascal: 4,363; perl: 2,920; java: 1,632; yacc: 755; lex: 258; sed: 93; xml: 12
file content (1 line) | stat: -rw-r--r-- 1,308 bytes parent folder | download | duplicates (2)
1
<html><head><title>define-struct</title><h1>define-struct</h1></head><body><code class="scheme">(<code class="scheme"><span class="keyword">define-struct</span></code> <b>NAME</b> (<b>NAME</b> ...))</code> <br /> The <code class="scheme"><span class="keyword">define-struct</span></code> form is used to define a new kind of structure. The structure's fields are named by the names in parentheses. After evaluation of a define-struct form, a set of new primitives is available for creation, extraction, and type-like queries: <ul> <li> <code class="scheme">make-STRUCTNAME</code> : takes a number of arguments equal to the number of fields in the structure, and creates a new instance of this structure. </li> <li> <code class="scheme">STRUCTNAME-FIELDNAME</code> : takes an instance of the structure and returns the field named by FIELDNAME. </li> <li> <code class="scheme">STRUCTNAME?</code> : takes any value, returns true if the value is an instance of the structure. </li> <li> <code class="scheme">STRUCTNAME</code> : an identifier representing the structure kind, but never used directly. </li> </ul> It is an error for any of the created names to be the same as another primitive or another user definition. <br /><p><a href="index.htm">Intermediate Student with Lambda Language</a></p></body></html>