| | 62 | Should we make it an ordered set, `$oset`? |
| | 63 | |
| | 64 | New 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 | }}} |