So, I notice I frequently type
First, I'm surprised I haven't been able to find an easier way to do this. Surely accessing a value from an associative array is not a rare task. Am I missing something?
What I've ended up doing is making it into a function:
(cdr (assoc key list)) in my code to access the values of associative lists.First, I'm surprised I haven't been able to find an easier way to do this. Surely accessing a value from an associative array is not a rare task. Am I missing something?
What I've ended up doing is making it into a function:
(defun cadsoc (key lis) (cdr (assoc key lis)))The problem with this is that I can't alter the value. If I use (cdr (assoc)) I can setf it to whatever I want, but setf doesn't know what to do with my function. How do I teach it?