Changes between Version 7 and Version 8 of TablesCowan


Ignore:
Timestamp:
08/27/10 13:59:33 (7 years ago)
Author:
cowan
Comment:

Added mutable and immutable copiers

Legend:

Unmodified
Added
Removed
Modified
  • TablesCowan

    v7 v8  
    88   1. Supports mutation as the primary means of setting the contents of a table. 
    99   1. Assumes that keys are immutable; mutating a key leads to unspecified behavior. 
     10   1. May be ''immutable'', meaning that associations may not be added or deleted and that the value associated with a key may not be changed. 
    1011 
    1112No particular implementation such as a-lists, red-black trees, or hash tables is mandated by this proposal.  Implementations SHOULD provide the most efficient implementation in time or space or both possible that is consistent with their larger goals; this may mean different implementations for tables of different lengths. 
     
    3031`(immutable-table `[''key'' ''value''] ... `)` 
    3132 
    32 The same as ``table``, except that the resulting table cannot be mutated either by adding or deleting associations or by changing the values of existing associations. 
     33The same as ``table``, except that the resulting table is immutable.   (Not in SRFI-69) 
     34 
    3335 
    3436`(alist->table `''alist''` . `''args''`)` 
    3537 
    36 Creates a new table as if by invoking `(make-table . `''args''`)` which maps the car of every element in ''alist'' to the cdr of the same element.  If some key occurs multiple times in alist, the value in the first association will take precedence over later ones.  (SRFI-69 `alist->hash-table`) 
     38Creates a new table as if by invoking `(make-table . `''args''`)` which maps the car of every element in ''alist'' to the cdr of the same element.  If some key occurs multiple times in alist, the value in the first association will take precedence over later ones. (SRFI-69 `alist->hash-table`) 
    3739 
    3840`(alist->immutable-table `''alist''` . `''args''`)` 
    3941 
    40 The same as `alist->table`, except that the resulting table cannot be mutated either by adding or deleting associations or by changing the values of existing associations. 
     42The same as `alist->table`, except that the resulting table is immutable.  (Not in SRFI-69) 
     43 
     44 
     45== Copiers == 
    4146 
    4247`(table-copy `''table''`)` 
    4348 
    44 Creates a new table with the same equivalence predicate, associations, and implementation-dependent properties (if any) as ''table''. (SRFI-69 `hash-table-copy`) 
     49Creates a new mutable table with the same equivalence predicate, associations, and implementation-dependent properties (if any) as ''table''. (SRFI-69 `hash-table-copy`) 
     50 
     51`(table-immutable-copy `''table''`)` 
     52 
     53Returns an immutable table with the same equivalence predicate, associations, and implementation-dependent properties (if any) as ''table''.  If ''table'' is immutable, implementations need not make a new table.  (Not in SRFI-69) 
     54 
    4555 
    4656== Predicates ==