DataspacePatterns: patterns over sets of literals #5
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Set of patterns are awkward but sets of literals make sense as a constrained array pattern.
Yes, though I'm cautious about introducing alternation within a pattern. Mostly because of the implemention of dataspaces.
Consider a pattern like
The way the "skeleton" structure used in the Racket/Rust/TypeScript dataspace implementations works is:
At step 2, we would have to have a cartesian product of all possible combinations for the three slots in the pattern array (1 4 7, 1 4 8, 1 4 9, ... , 2 6 7, ... , 3 6 9). We currently use a simple array because we know there can only be one possible expected-value at each position in the projection. To accommodate a cartesian product, we would have to switch to something more complex like a(nother) trie or something.
Another approach is to imagine sets as being something like Dictionaries mapping their values to some constant, say
#t
. Then we can reuse the matching we permit over Dictionaries: we treat set members / dictionary keys as steps in a structural path, only leading to "no values" with sets rather than the target value with dictionaries.