Reconcile two sorted snapshots with repeated keys
A duplicate row should not look like a newly added key. Compare distinct sets and report repeated occurrences separately. The new snapshot adds key 3, removes key 1 and retains 2 and 4. The repeated 2 contributes one duplicate occurrence.
Run the framework with your own input
Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.
git clone --depth 1 --branch v0.1.0 https://github.com/Rahulchaube1/blyx-chaffinch.git
cd blyx-chaffinch
blyxc native-run project.blyx -- "1,1,2,4" "2,2,3,4"API and return values
Returns [added unique keys, removed unique keys, retained keys, duplicate occurrences in the new snapshot]. Inputs are sorted, allowing forward-only scans. Invalid input returns an empty vector.
| Argument | Accepted input |
|---|---|
| old | Vector of: exact signed integer |
| fresh | Vector of: exact signed integer |
Use the libraries independently
The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.
Try the program
Expected output
1 1 2 1
Practice
Change old = [], fresh = [9, 9]. Predict the result, then run the program.
Hint
Returns [added unique keys, removed unique keys, retained keys, duplicate occurrences in the new snapshot]. Inputs are sorted, allowing forward-only scans.
Worked solution
The result vector is [1, 0, 0, 1]. Compare its fields with the return layout in the API section.
Find
let old = [1, 1, 2, 4];Replace with
let old = [];Find
let fresh = [2, 2, 3, 4];Replace with
let fresh = [9, 9];Output after the change
1 0 0 1
