Not that I am an expert in ephemeral data structures, but along with tries Ι wanted to know more this. I decided to give a small lightning talk about it, in order to get questions and help myself understand it better.
I only scratched the surface, I feel more confused than ever and most probably I will come back to this post in the future to correct myself. I would love this to happen, because it means I understood what’s going on. Below I will share some of the main points.

So, as choosing Scala for this apprenticeship journey, I came for the first time across many complex concepts and terms. I could not understand why most of the Scala collections are immutable, I just accepted it. But it all fits into the concept of functional programming, where destructive updates are not supported. This means I cannot just modify my Data Structure and destroy the previous version. All versions are expected to be preserved fully functional after any successful operation. Persistent DS are effectively immutable, as the updates do not affect current version, but they yield to a new one.

All immutable collections in Scala are persistent. What happens is called structural sharing - we don’t copy the whole structure, instead we share it by copying the path. For example, in a list:

persistent linked list
Source: geeksforgeeks

The cost of immutability when you deal with big collections is sometimes an impact in performance, but in general you reduce complexity and unexpected changes or behaviors.

So, although I didn’t manage to deep dive into the topic, I still feel I learned a lot and gave a lightning talk to share it. It was my first ever, so of course it was weird and lame, but my challenge was not to give a public talk, but explain something that I am not good at. This means more of them will follow and who knows? Maybe the day comes that I will give a proper talk about something that I am really good at. Until then, I will keep struggling 😅

Song of the day