gluon icon indicating copy to clipboard operation
gluon copied to clipboard

Add a persistent vector type

Open Marwes opened this issue 6 years ago • 5 comments

The existing Array type is implemented as a plain array which is nice for Rust interop (Array Byte can be transformed into a &[u8] at not cost). This plain representation is on the other hand inefficient if one wants to append to or modify elements in the array since the entire array needs to be copied on each modification.

As an alternative we should have a persistent vector type in the standard library which can be used if modification is frequently required.

This series of posts (found from https://github.com/orium/rpds) explains how these vectors are implemented in Clojure and seem to be a good start towards an implementation (currently browsing through them). https://hypirion.com/musings/understanding-persistent-vector-pt-1

Marwes avatar Mar 14 '18 13:03 Marwes

Depends on #474

Marwes avatar Mar 14 '18 16:03 Marwes

Another option might be https://github.com/bodil/im-rs

brendanzab avatar Mar 14 '18 23:03 brendanzab

Another option might be https://github.com/bodil/im-rs

Doesn't seem to have an immutable vector type? In any case I think this type ought to be implemented in pure gluon (so any Rust implementation will only be useful for inspiration :) ).

Marwes avatar Mar 15 '18 09:03 Marwes

I'd love to take a stab at implementing this if noone is actively working on this!

omegablitz avatar Dec 04 '19 07:12 omegablitz

No ones working on this. Looking forward to it!

Marwes avatar Dec 04 '19 15:12 Marwes