|
|
|
|
|
by hope-striker
2283 days ago
|
|
There are better alternatives to linked lists for this use case. 1. Clojure uses wide balanced trees as its general-purpose ordered collection.[0] These have probably already been adapted for Haskell, and they offer persistence and fast random access and some degree of cache-friendliness. In my opinion it makes better trade-offs as a general-purpose structure. 2. By passing an &[usize] in Rust, or a const size_t* in C (i.e. by making g accept a read-only pointer), you can be guaranteed that g doesn't modify the array. [0]: https://hypirion.com/musings/understanding-persistent-vector... |
|