Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #73
Sorry for the delay @dotboris, we just missed each other last time I passed through.
Just before implementing this, I realised that using the optional
xform
parameter (eg.(mr/sync-r ref (partial into (sorted-map)))
) should also be sufficient. But that does involve a awkward extra allocation path over the data, and doesn't handle nested maps. Handling those would make it even more awkward 😆Here I've just made
sorted-maps
the default. But the implementation leaks out, and theclojure.lang.Sorted
property comes at a price: keys are now typed.This could break quite a bit of old code, so I'm not completely comfortable with this. Perhaps using something like Linked's order-preserving maps would be preferable, with the added bonus of then working with queries and/or custom priorities.
But I'm loath to add another dependency, and also this "preserve insert order" property is perhaps more confusing than helpful when you start manipulating the data. Or perhaps not a real issue - since the default keys are server generated and monotonically increasing..
The cop out would be to just implement #51 and let poor users choose their trade-off.
That burns down the issue queue fastest, so I'm copping out 😄