Posts

Showing posts with the label immutability

What persistent data structures does Raku/Rakudo include?

14 1 Raku provides many types that are immutable and thus cannot be modified after they are created. Until I started looking into this area recently, my understanding was that these Types were not persistent data structures – that is, unlike the core types in Clojure or Haskell, my belief was that Raku's immutable types did not take advantage of structural sharing to allow for inexpensive copies. I thought that statement my List $new = (|$old-list, 42); literally copied the values in $old-list , without the data-sharing features of persistent data structures. That description of my understanding is in the past tense, however, due to the following code: my Array $a = do { $_ = [rand xx 10_000_000]; say "Initialized an Array in $((now - ENTER now).r...