I have a list of plists such as
'((:atom Toddler :visited nil :on-clauses (0 1))
(:atom Child :visited nil :on-clauses 1))
how should I change the :onclauses
property on a given :atom
? I'd like to update this property, e.g. making the second plist (:atom Child :visited nil :on-clauses (1 2))
(only adding new values, never deleting the old ones).
the best I could do was to create a new list from scratch using
(remove-if-not #'(lambda(record)
(equal (getf record :atom) atom))
*ATOMS*)
to get the initial value, updating it, then using its analogue to get a list without this value, and append both together, but this is probably terribly inneficient (I know premature optimatization is bad, but I'm learning LISP and want to know how to do things properly!)