Changeset 26087 in project for wiki/eggref/4/tuples


Ignore:
Timestamp:
03/07/12 11:23:27 (9 years ago)
Author:
juergen
Message:

tuples: single-state and single-state! renamed to single-ref and single-set!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/tuples

    r25632 r26087  
    44== tuples
    55
    6 Tuples are a datatype which has much in common with vectors. Namely they store a finite number of items with random access and make them available via (tuple-ref tup n). But contrary to vectors, the items can only by accessed but not assigned to. If you want to change a particular item, you must package it into a box or a single, which is a special tuple storing exactly one item, which can be changed via single-state! without changing the identity of the single object itself.
     6Tuples are a datatype which has much in common with vectors. Namely they store a finite number of items with random access and make them available via (tuple-ref tup n). But contrary to vectors, the items can only by accessed but not assigned to. If you want to change a particular item, you must package it into a box or a single, which is a special tuple storing exactly one item, which can be changed via single-set! without changing the identity of the single object itself.
    77
    88singles are the only tuples, which can assign to their content. Other special tuples are empty, couple and triple. Note, that couples can be used instead of pairs to implement immutable lists.
     
    7474        tests for a tuple storing two items
    7575
    76         single-state!
    77         -------------
    78         (single-state! sg arg)
     76        single-set!
     77        -----------
     78        (single-set! sg arg)
    7979        replaces state of sg with arg
    8080        (domain (%single? sg) (true? arg))
    8181        (effect (state (%tuple-state sg) arg))
    8282
    83         single-state
    84         ------------
    85         (single-state sg)
     83        single-ref
     84        ----------
     85        (single-ref sg)
    8686        returns the state of the single object sg
    8787        (domain (%single? sg))
     
    211211== Last update
    212212
    213 Oct 20, 2011
     213Mar 07, 2012
    214214
    215215== Author
     
    219219== License
    220220
    221  Copyright (c) 2011, Juergen Lorenz
     221 Copyright (c) 2012, Juergen Lorenz
    222222 All rights reserved.
    223223
     
    250250== Version History
    251251
     252; 0.7 : single-state and single-state! renamed to single-ref and single-set!
    252253; 0.6 : contracts rewritten
    253254; 0.5 : code maintenance
Note: See TracChangeset for help on using the changeset viewer.