lucaong / immutable

Thread-safe, persistent, immutable collections for the Crystal language
MIT License
203 stars 11 forks source link

Transient structures #3

Closed lucaong closed 8 years ago

lucaong commented 8 years ago

Implement transient structures to make bulk updates efficient. Transient structures are mutable and perform updates in-place. They can be converted from/into immutable structures in constant time, and they get invalidated after the updates are applied:

vector = Immutable::Vector.new([1, 2, 3])

vector = vector.transient do |vec|
  100.times { |i| vec = vec.push(i) }
end

Roadmap: