title: Add or replace an item in a nested association list
body: <p>From the docs:</p>
  
  <blockquote>
    <p>The variable <code>window-system-default-frame-alist</code> is an alist of
    elements <code>(WINDOW-SYSTEM . ALIST)</code>, where <code>WINDOW-SYSTEM</code> is a
    window system symbol and <code>ALIST</code> is a frame parameter alist.</p>
  </blockquote>
  
  <p>Let's say I want to change the frame parameter alist for the X Window System, so that it contains the element <code>(font . "Monospace-11")</code>, but I don't want multiple <code>font</code> elements in that alist.</p>
  
  <p>So what do I do? Basically, I go over the alists, remove the element I want to replace/add, and then add the element.  This is the code:</p>
  
  <pre><code>(let ((x-frame-alist (alist-get 'x window-system-default-frame-alist)))
    (cl-acons 'x (cl-acons 'font "Monospace-11"
                           (cl-remove (cl-assoc 'font x-frame-alist)
                                      x-frame-alist))
              (cl-remove `(x . ,x-frame-alist)
                         window-system-default-frame-alist)))
  </code></pre>
  
  <p>Then the result must be assigned to the symbol <code>window-system-default-frame-alist</code>.  But somehow all this looks overly complicated.  Surely there must be a simpler solution.</p>