Arc Forumnew | comments | leaders | submitlogin
1 point by lark 4808 days ago | link | parent

Can I persist and read back a #hash that contains a #hash?

Alternatively, can I persist and read back a list of hash tables?



1 point by akkartik 4808 days ago | link

Yeah I have those in my repo. Look for serialize in the link in my profile.

I'll add it to anarki later today.

Update: I just found myself complaining about this nearly 3 years ago, along with an implementation: http://arclanguage.org/item?id=10677. Not as clean as serialize, though.

Update 2: Ok, now read and write work with nested tables. You can read the output of write:

  arc> (= h (w/instring f (tostring (write (obj a 1 b (obj c 3 d 4)))) read.f))
  #hash((a . 1) (b . #hash((c . 3) (d . 4))))
And you can modify the results:

  arc> (= h!c 34) ; modify outer table
  arc> h
  #hash((c . 34) (a . 1) (b . #hash((c . 3) (d . 4))))

  arc> (= h!b!e 34) ; modify inner table
  arc> h
  #hash((c . 34) (a . 1) (b . #hash((c . 3) (e . 34) (d . 4))))
http://github.com/nex3/arc/commit/547d8966de

-----