Changeset 12598 in project


Ignore:
Timestamp:
11/26/08 20:42:08 (11 years ago)
Author:
sjamaan
Message:

Revert chicken 4 documentation in defstruct egg doc for release 3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/defstruct

    r11783 r12598  
    1111=== Author
    1212
    13 Dorai Sitaram, ported to CHICKEN by [[felix winkelmann]], with improvements by [[peter bex]]
     13Dorai Sitaram, ported to CHICKEN by [[felix winkelmann]]
    1414
    1515=== Requirements
     
    2929value of the slot (the {{INIT}} expression will only be evaluated when
    3030no value is given in the constructor procedure).  The {{defstruct}}
    31 macro expands into predicate and accessor functions (just like the
     31macro expand into predicate and accessor functions (just like the
    3232native {{define-record}}):
    3333
    3434<example>
    35 <init>
    36 (require-extension defstruct)
    37 </init>
    3835<expr>(defstruct point x y)</expr>
    3936<result>
     
    5249<example>
    5350<expr>
    54 (define p1 (make-point x: 99 y: 42))
    55 p1
     51(make-point x: 99 y: 42)
    5652</expr>
    5753<result>; a point with x = 99 and y = 42</result>
    58 </example>
    59 
    60 On Chicken 4 and higher, there are also two procedures {{update-STRUCTNAME}}
    61 and {{set-STRUCTNAME!}} defined for functionally and destructively updating
    62 selected values in an existing record:
    63 
    64 <example>
    65 <expr>
    66 (define p2 (point-copy p1 x: 100))
    67 p2
    68 </expr>
    69 <result>; a point with x = 100 and y = 42</result>
    70 <expr>
    71 (= p1-x 99)
    72 </expr>
    73 <result>#t</result>
    74 <expr>
    75 (set-point! p1 x: 100)
    76 (= p1-x 100)
    77 </expr>
    78 <result>#t</result>
    7954</example>
    8055
     
    8257
    8358  Copyright (c) 2005, Dorai Sitaram
    84   Copyright (c) 2005, Felix Winkelmann (Chicken port)
    85   Copyright (c) 2008, Peter Bex (Hygienic Chicken port + extensions)
    8659  All rights reserved.
    8760 
Note: See TracChangeset for help on using the changeset viewer.