Changes between Version 2 and Version 3 of DataStructures


Ignore:
Timestamp:
07/03/14 07:41:44 (12 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataStructures

    v2 v3  
    6060== Sets ==
    6161
     62Should we make it an ordered set, `$oset`?
     63
     64New type: `$set`.  Functions:
     65
     66{{{
     67/* Returns the empty set whose elements (if it had any)
     68 * would have the given type.  The type becomes associated
     69 * with the set.  */
     70$set $set_empty($type type);
     71
     72/* Returns the type of an element that goes in this set */
     73$type $set_element_type($set v);
     74
     75/* Returns the set that is like the given one but with one more
     76 * element added.  A runtime exception is generated if the thing pointed
     77 * to by eltptr doesn't have the right type for s. */
     78$set $set_add($set v, void * eltptr);
     79
     80/* Returns the set that is like the given one but with the specified element
     81 * removed.  If the set does not contain the element the set returned
     82 * will equal the given one. */
     83$set $set_remove($set s, void * eltptr);
     84
     85/* Does the set contain the specified element? */
     86_Bool $set_contains($set s, void * eltptr);
     87
     88$set $set_union($set s1, $set s2);
     89
     90$set $set_intersection($set s1, $set s2);
     91
     92$set $set_difference($set s1, $set s2);
     93
     94/* Returns the singleton set consisting of the single element
     95 * specified by the pointer and the type */
     96$set $set_single($type type, void * eltptr);
     97
     98// need a way to iterate over elements of a set.
     99
     100}}}
    62101
    63102
    64103== Maps ==
    65104
     105`$map`
     106
     107{{{
     108$map $map_empty($type keyType, $type valType);
     109
     110$map $map_put($map map, void * keyPtr, void * valPtr);
     111
     112void $map_get($map map, void * keyPtr, void * resultPtr);
     113
     114$map $map_removeKey($map map, void * keyPtr);
     115}}}
     116
     117