All objects in Objective-C actually maintain their reference count. This is how ARC works. So, if there is only one reference to a vector, and we create a new modified vector with a new element, the changed nodes of the old vector will set reference count to 0 and will be disposed.
On Wednesday, November 12, 2014 12:36:36 PM UTC-8, Stephen Wakely wrote: > > Interesting. I would definitely look into this if I ever need to do > another iOS app. > > How does it work in a language without garbage collection? If you replace > an element in a vector and only keep a reference to the new vector there > will be a stray element there that would need mopping up. Is ARC clever > enough to recognise this? I wouldn't have thought so unless you maintain a > reference count for every element within the vector.. Which I don't imagine > would be particularly efficient. > > On Wed, 12 Nov 2014 3:48 PM Anton Astashov <anton.a...@gmail.com > <javascript:>> wrote: > >> Sorry for resurrecting of such an old post, but I just wrote port of >> Clojure's data structures in Objective-C - >> https://github.com/astashov/persistent.objc - hopefully one day someone >> will find that useful. :) >> >> On Sunday, March 31, 2013 5:43:52 AM UTC-7, Matthias Benkard wrote: >>> >>> I implemented persistent, array-mapped Patricia trees in C a while ago: >>> >>> https://matthias.benkard.de/journal/118 >>> >>> It should be relatively straight-forward to build some Objective-C >>> classes on top of that. (There's a reason the memory management routines >>> are named bpt_{retain, release, dealloc}. :)) >>> >>> You'll just need to do the hashing yourself if you want to build a hash >>> map. >>> >>> Matthias >>> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clo...@googlegroups.com >> <javascript:> >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+u...@googlegroups.com <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+u...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.