Changeset 11582 in project


Ignore:
Timestamp:
08/09/08 23:55:34 (11 years ago)
Author:
sjamaan
Message:

Update documentation for Chicken 4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/defstruct

    r10710 r11582  
    1111=== Author
    1212
    13 Dorai Sitaram, ported to CHICKEN by [[felix winkelmann]]
     13Dorai Sitaram, ported to CHICKEN by [[felix winkelmann]], with improvements by [[peter bex]]
    1414
    1515=== Requirements
     
    3333
    3434<example>
     35<init>
     36(require-extension defstruct)
     37</init>
    3538<expr>(defstruct point x y)</expr>
    3639<result>
     
    4952<example>
    5053<expr>
    51 (make-point x: 99 y: 42)
     54(define p1 (make-point x: 99 y: 42))
     55p1
    5256</expr>
    5357<result>; a point with x = 99 and y = 42</result>
     58</example>
     59
     60On Chicken 4 and higher, there are also two procedures {{copy-STRUCTNAME}}
     61and {{set-STRUCTNAME!}} defined for functionally and destructively updating
     62selected values in an existing record:
     63
     64<example>
     65<expr>
     66(define p2 (copy-point p1 x: 100))
     67p2
     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>
    5479</example>
    5580
     
    5782
    5883  Copyright (c) 2005, Dorai Sitaram
     84  Copyright (c) 2005, Felix Winkelmann (Chicken port)
     85  Copyright (c) 2008, Peter Bex (Hygienic Chicken port + extensions)
    5986  All rights reserved.
    6087 
Note: See TracChangeset for help on using the changeset viewer.