Comments (3)
Currently Vector<_>
doesn't support operations that push or drop from the front. We don't need finger trees to implement that. The data structure can be modified to allow for those operations, it is just that I never got to implement those (issue #17).
Vector<_>
needs some love at this point. I'll try to allocate some time to it next month (I /should/ have some free time for that).
from rpds.
+1 - would be great to have an O(1) way to do slices that takes advantage of structural sharing
from rpds.
Well...just so you know this problem is actually quite difficult because the OG Clojure that popularized this idea doesn't support prepending/drop front either: https://stackoverflow.com/questions/4095714/what-is-the-idiomatic-way-to-prepend-to-a-vector-in-clojure
If we can make it so that we can efficiently drop front, then implementing slice/ops::Range can be amortized to O(log n), by repeating drop front until range start, and repeating drop back until range end.
If we can have the other way round, I think we need to modify the data structure used for persistent vector in rpds to support efficient meld operation. That means we can quickly access the "chunks" of different shared vectors, separated like a B-Tree, and we can first persistent clone the whole tree, then find the specific leaf, and clone it to a normal vector, remove the sub-index in the cloned normal vector according to the item position in the chunk, and then meld (aka tree merge) this new vector back to the rest of the tree. This can achieve structural sharing to some sort, but it will sure be hell to implement. (I took this idea from rope data structure)
Wait hold on. No way, did I just reinvented finger tree?
from rpds.
Related Issues (20)
- Debug shows internal data in all data structures and iterators
- Avoiding stackoverflow when dropping large List HOT 3
- Add feature to provide Trace and Finalize impls for https://github.com/Manishearth/rust-gc
- HAMP vs CHAMP
- Implement .range_index() for RedBlackTreeMap/RedBlackTreeSet HOT 1
- Memory Usage for Debugging HOT 4
- Is this stable for handling large scale data (> 10^8) HOT 1
- Finger Trees HOT 1
- `RedBlackTreeSet`'s docs mention non-existent `get` operation HOT 2
- Consider re-exporting archery items
- Consider providing a .pop_with_value() helper on Stack and List
- Support custom allocator HOT 1
- Serializing multiple instances efficiently HOT 1
- extract variants of remove on HashTrieMap and RedBlackTreeMap
- Add a "feature" to remove _mut methods HOT 4
- Opening doc. HOT 1
- Non-empty containers HOT 1
- sparse_array_usize test failures on i686 HOT 2
- FYI: Python bindings / Minor README question HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rpds.