Arc Forumnew | comments | leaders | submitlogin
2 points by aw 3675 days ago | link | parent

Too bad (= x!first "new") didn't work

hmm, it seems like the association list thing to do for a set would be to push a new pair onto the front of the association list, so that

  (= x!foo 'bar)
would be like saying

  (push '(foo bar) x)
when x was a cons and foo wasn't a number. But I don't know how to do that, or if it's possible.

On the other hand, if you want to modify existing associations in place:

  (extend sref (com val ind) (and (acons com) (isnt (type ind) 'int))
    (aif (assoc ind com) (= (cadr it) val)))

  arc> (= x '((a "A") (b "B") (c "C")))
  ((a "A") (b "B") (c "C"))
  arc> (= x!b "X")
  "X"
  arc> x
  ((a "A") (b "X") (c "C"))
though that won't let you add new keys to the alist.