File | bag.str |
Author | unknown |
Since | unknown |
This module contains strategies for handling bags.
A bag is a set of elements where each element has an occurence number. Addingan element to a bag which already exists, will increase the occurence numberfor that element by one.
In the current implementation, bags are represented as lists of (element,occurrence) tuples. Adding a new element is done using bag-insert.
General | |
Lines of code | 50 |
Stratego | |
Module number | 1 (100% documented) |
Constructor number | 0 |
Overlay number | 0 |
Strategy number | 0 |
Rule number | 4 (100% documented) |
DynamicRule number | 0 |
Rule summary |
||
bag-insert | Inserts a new element into a bag | bag.str |
bag-insert(Strategy equ) | Inserts a new element into a bag | bag.str |
bag-union | Takes the union of two bags | bag.str |
bag-union(Strategy equ) | Takes the union of two bags | bag.str |
Rule details |
|||||||||||||||
ATerm | bag-insert | ||||||||||||||
Inserts a new element into a bag. The element must be on the forma (element, occurrence) tuple, where occurrence is an integer. Thebag may be empty. Example: <bag-insert> (('a', 1), []) => [('a',1)]
|
|||||||||||||||
ATerm | bag-insert(Strategy equ) | ||||||||||||||
Inserts a new element into a bag. The element must be on the forma (element, occurrence) tuple, where occurrence is an integer. Thebag may be empty. The strategy parameter is used to check elementsfor equality.
|
|||||||||||||||
ATerm | bag-union | ||||||||||||||
Takes the union of two bags. Example: <bag-union> ([('a',2), ('b',1)], [('a',1)]) => [('b',1),('a',3)]
|
|||||||||||||||
ATerm | bag-union(Strategy equ) | ||||||||||||||
Takes the union of two bags. The strategy parameter is usedto check elements for equality.
|
|||||||||||||||