Persistent data structures
ShalokShalom opened this issue · comments
Hi :)
I consider Nim as a language and as such, I hope to find some way to keep my data persistent.
Does this project evaluate that and if thats a no, can you recommend one?
Hi @ShalokShalom ,
can you rephrase your question and make it a real issue - cause you opened an issue: which normally is for having a specific problem - e.g. I got the code or idea - how do I do that with this library?
Also persistent data
is probably confusing: do you mean persistent data storage (which actually is the more common use of the word persistent) or immutable data structures? I guess the latter?
zero_functional is "just" a way to use functional programming algorithms with the nim programming language. It does not aim at providing a complete environment for functional programming - so basically immutable data structures are supported as far as they can be iterated. The main use cases all create new objects leaving the traversed data untouched - exception is (the only) meta function with side-effects: that is foreach
. See documentation.
... and after just doing a little research: I don't know of such a library (an immer.js for nim?). I don't think this is a concept that fits with zero_functional - at least I cannot think of a way that it would fit. immer.js looks (if I understand the concept correctly) like a framework that watches the data for changes and creates clones with the changes if needed. When creating output as a collection (seq, array, etc) zero_functional creates a new copy with all the data everytime (except the mentioned foreach and of course if the last operation leads to a simple non-collection result). So basically - immutable: yes - or rather: cloned: yes, with specific optimizations done and copying only when required: no.
But you can propose some actual use cases if you like :-)