<commit_before><!DOCTYPE html>

<html>

  <head>
    <meta charset="UTF-8" />
    <meta name="author" content="<NAME>" />
    <link rel="author" href="https://abc.hexstream.xyz/" />
    <link rel="license" href="https://www.hexstreamsoft.com/UNLICENSE" />
    <meta name="description" content="Provides a few utilities relating to setfable places. Notably provides SETF-EXPANDERLET (and WITH-RESOLVED-PLACES, which uses it)." />
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>place-utils | Libraries | HexstreamSoft</title>
    <link href="https://www.hexstreamsoft.com/css/global.css" rel="stylesheet" type="text/css" />
    <link href="https://www.hexstreamsoft.com/libraries/libraries.css" rel="stylesheet" type="text/css" />
    <script src="https://global.hexstreamsoft.com/scripts/global.js"></script>
    <script src="https://www.hexstreamsoft.com/scripts/global.js"></script>
    <script src="https://www.hexstreamsoft.com/libraries/libraries.js" defer></script>
  </head>

  <body>

    <nav id="top-nav">

      <div class="main">

        <div class="breadcrumbs">
          <a href="https://www.hexstreamsoft.com/">HexstreamSoft</a>
          <span class="crumb"><span class="s"> » </span><a href="https://www.hexstreamsoft.com/libraries/">Libraries</a></span>
          <span class="crumb"><span class="s"> » </span><a class="here">place-utils</a></span>
        </div>

      </div>

      <p id="last-updated"><span>This page was last updated on </span><time datetime="2018-08-21">21 august 2018</time><span>.</span></p>

    </nav>

    <main>

      <header id="page-header">
        <h1>place-utils</h1>
      </header>

      <div class="tags contains-groups">
        <div class="group prominent">
          <span class="tag hv license">
            <span class="h">License<span>:</span></span>
            <span class="v">Public Domain</span>
          </span>
          <span class="s">, </span>
          <span class="tag github"><a href="https://github.com/Hexstream/place-utils">See on GitHub</a></span>
          <span class="s">, </span>
          <span class="tag hv quicklisp">
            <span class="h">Load it with Quicklisp<span>:</span></span>
            <code class="v">(ql:quickload "place-utils")</code>
          </span>
        </div>
        <div class="group">
          <span class="tag hv">
            <span class="h">Library type<span>:</span></span>
            <span class="v">Thematic utilities</span>
          </span>
          <span class="s">, </span>
          <span class="tag hv">
            <span class="h">Project complexity<span>:</span></span>
            <span class="v">Simple</span>
          </span>
        </div>
      </div>

      <nav class="tabs" id="further-info">
        <ul>
          <li><a href="https://www.hexstreamsoft.com/libraries/releases/latest-versions/#place-utils">Latest release</a></li>
          <li><a href="https://www.hexstreamsoft.com/libraries/dependencies/#place-utils">Dependencies</a></li>
        </ul>
        <ul>
          <li><a href="https://www.hexstreamsoft.com/libraries/external-pages-xref/#place-utils">External library pages</a></li>
        </ul>
      </nav>

      <section id="introduction">

        <p>place-utils provides a few utilities relating to setfable places.</p>

      </section>

      <nav class="tabs">
        <ul>
          <li><a href="#setf-expanderlet">setf-expanderlet</a></li>
          <li><a href="#with-resolved-places">with-resolved-places</a></li>
          <li><a href="#updatef">updatef</a></li>
          <li><a href="#bulkf">bulkf</a></li>
          <li><a href="#funcallf-applyf">funcallf-applyf</a></li>
          <li><a href="#cachef">cachef</a></li>
          <li><a href="#oldf">oldf</a></li>
          <li><a href="#readf">readf</a></li>
          <li><a href="#tracef">tracef</a></li>
        </ul>
      </nav>

      <section id="setf-expanderlet">

        <h1 class="breadcrumbs-bar">
          <span class="section-relative-nav">
            <a href="#setf-expanderlet" class="anchor">⚓</a>
          </span>
          <span class="breadcrumbs">
            <a href="#">place-utils</a>
            <span class="crumb"><span class="s"> » </span><a class="here">setf-expanderlet</a></span>
          </span>
        </h1>

        <p class="description">Introduce local setf-expanders.</p>

        <dl>

          <dt><pre>Macro <code class="common-lisp library macro operator">setf-expanderlet</code> (&amp;rest <var>bindings</var>) &amp;body <var>body</var>
  &rArr; <var>results</var></pre></dt>

          <dd>
            <p><code class="common-lisp library macro operator">setf-expanderlet</code> introduces local setf-expanders. This opens possibilities for more complex local setf-expanders than can be handled by Common Lisp's built-in support for local setf functions (which must evaluate all their arguments once from left to right and can only accept one new value at a time).</p>
            <p><code class="common-lisp library macro operator">setf-expanderlet</code> is to <code class="common-lisp standard macro operator"><a href="http://www.lispworks.com/documentation/HyperSpec/Body/m_defi_3.htm">define-setf-expander</a></code> as <code class="common-lisp standard macro operator"><a href="http://www.lispworks.com/documentation/HyperSpec/Body/s_flet_.htm">macrolet</a></code> is to <code class="common-lisp standard macro operator"><a href="http://www.lispworks.com/documentation/HyperSpec/Body/m_defmac.htm">defmacro</a></code>. The <var>bindings</var> of <code class="common-lisp library macro operator">setf-expanderlet</code> have much the same semantics as their counterparts in <code class="common-lisp standard macro operator"><a href="http://www.lispworks.com/documentation/HyperSpec/Body/s_flet_.htm">macrolet</a></code>, except the job of each expander is to return a <a href="http://www.lispworks.com/documentation/HyperSpec/Body/05_aab.htm">setf expansion</a> (5 values), not a normal expansion (a form).</p>
            <p>As an example of what <code class="common-lisp library macro operator">setf-expanderlet</code> can let one accomplish, <code class="common-lisp library macro operator">with-resolved-places</code> is trivially implemented in terms of it.</p>
            <p><b>Implementation note:</b> Surprisingly enough, this implementation of <code class="common-lisp library macro operator">setf-expanderlet</code> is written fully portably. As far as I can tell, the only caveat is that the name of the local setf-expander is unconditionally made a local macro. This macro, if used in a non-place context, simply expands to a form that evaluates the subforms and then reads the place.</p>
            <p>In contrast, "real" setf-expanders as defined by <code class="common-lisp standard macro operator"><a href="http://www.lispworks.com/documentation/HyperSpec/Body/m_defi_3.htm">define-setf-expander</a></code> don't affect the semantics of the operator in non-place contexts, which is useful if the operator is a function. However, if the original operator is simple enough that it's implemented as a function, you can probably just use a local setf function anyway so I don't think the aforementioned caveat is very important.</p>
          </dd>
        </dl>

      </section>

      <section id="with-resolved-places">

        <h1 class="breadcrumbs-bar">
          <span class="section-relative-nav">
            <a href="#with-resolved-places" class="anchor">⚓</a>
          </span>
          <span class="breadcrumbs">
            <a href="#">place-utils</a>
            <span class="crumb"><span class="s"> » </span><a class="here">with-resolved-places</a></span>
          </span><commit_msg>Greatly simplify code sample markup to reduce maintenance burden.<commit_after><!DOCTYPE html>

<html>

  <head>
    <meta charset="UTF-8" />
    <meta name="author" content="<NAME>" />
    <link rel="author" href="https://abc.hexstream.xyz/" />
    <link rel="license" href="https://www.hexstreamsoft.com/UNLICENSE" />
    <meta name="description" content="Provides a few utilities relating to setfable places. Notably provides SETF-EXPANDERLET (and WITH-RESOLVED-PLACES, which uses it)." />
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>place-utils | Libraries | HexstreamSoft</title>
    <link href="https://www.hexstreamsoft.com/css/global.css" rel="stylesheet" type="text/css" />
    <link href="https://www.hexstreamsoft.com/libraries/libraries.css" rel="stylesheet" type="text/css" />
    <script src="https://global.hexstreamsoft.com/scripts/global.js"></script>
    <script src="https://www.hexstreamsoft.com/scripts/global.js"></script>
    <script src="https://www.hexstreamsoft.com/libraries/libraries.js" defer></script>
  </head>

  <body>

    <nav id="top-nav">

      <div class="main">

        <div class="breadcrumbs">
          <a href="https://www.hexstreamsoft.com/">HexstreamSoft</a>
          <span class="crumb"><span class="s"> » </span><a href="https://www.hexstreamsoft.com/libraries/">Libraries</a></span>
          <span class="crumb"><span class="s"> » </span><a class="here">place-utils</a></span>
        </div>

      </div>

      <p id="last-updated"><span>This page was last updated on </span><time datetime="2018-08-21">21 august 2018</time><span>.</span></p>

    </nav>

    <main>

      <header id="page-header">
        <h1>place-utils</h1>
      </header>

      <div class="tags contains-groups">
        <div class="group prominent">
          <span class="tag hv license">
            <span class="h">License<span>:</span></span>
            <span class="v">Public Domain</span>
          </span>
          <span class="s">, </span>
          <span class="tag github"><a href="https://github.com/Hexstream/place-utils">See on GitHub</a></span>
          <span class="s">, </span>
          <span class="tag hv quicklisp">
            <span class="h">Load it with Quicklisp<span>:</span></span>
            <code class="v">(ql:quickload "place-utils")</code>
          </span>
        </div>
        <div class="group">
          <span class="tag hv">
            <span class="h">Library type<span>:</span></span>
            <span class="v">Thematic utilities</span>
          </span>
          <span class="s">, </span>
          <span class="tag hv">
            <span class="h">Project complexity<span>:</span></span>
            <span class="v">Simple</span>
          </span>
        </div>
      </div>

      <nav class="tabs" id="further-info">
        <ul>
          <li><a href="https://www.hexstreamsoft.com/libraries/releases/latest-versions/#place-utils">Latest release</a></li>
          <li><a href="https://www.hexstreamsoft.com/libraries/dependencies/#place-utils">Dependencies</a></li>
        </ul>
        <ul>
          <li><a href="https://www.hexstreamsoft.com/libraries/external-pages-xref/#place-utils">External library pages</a></li>
        </ul>
      </nav>

      <section id="introduction">

        <p>place-utils provides a few utilities relating to setfable places.</p>

      </section>

      <nav class="tabs">
        <ul>
          <li><a href="#setf-expanderlet">setf-expanderlet</a></li>
          <li><a href="#with-resolved-places">with-resolved-places</a></li>
          <li><a href="#updatef">updatef</a></li>
          <li><a href="#bulkf">bulkf</a></li>
          <li><a href="#funcallf-applyf">funcallf-applyf</a></li>
          <li><a href="#cachef">cachef</a></li>
          <li><a href="#oldf">oldf</a></li>
          <li><a href="#readf">readf</a></li>
          <li><a href="#tracef">tracef</a></li>
        </ul>
      </nav>

      <section id="setf-expanderlet">

        <h1 class="breadcrumbs-bar">
          <span class="section-relative-nav">
            <a href="#setf-expanderlet" class="anchor">⚓</a>
          </span>
          <span class="breadcrumbs">
            <a href="#">place-utils</a>
            <span class="crumb"><span class="s"> » </span><a class="here">setf-expanderlet</a></span>
          </span>
        </h1>

        <p class="description">Introduce local setf-expanders.</p>

        <dl>

          <dt><pre>Macro <code class="common-lisp library macro operator">setf-expanderlet</code> (&amp;rest <var>bindings</var>) &amp;body <var>body</var>
  &rArr; <var>results</var></pre></dt>

          <dd>
            <p><code class="common-lisp library macro operator">setf-expanderlet</code> introduces local setf-expanders. This opens possibilities for more complex local setf-expanders than can be handled by Common Lisp's built-in support for local setf functions (which must evaluate all their arguments once from left to right and can only accept one new value at a time).</p>
            <p><code class="common-lisp library macro operator">setf-expanderlet</code> is to <code><a href="http://www.lispworks.com/documentation/HyperSpec/Body/m_defi_3.htm">define-setf-expander</a></code> as <code><a href="http://www.lispworks.com/documentation/HyperSpec/Body/s_flet_.htm">macrolet</a></code> is to <code><a href="http://www.lispworks.com/documentation/HyperSpec/Body/m_defmac.htm">defmacro</a></code>. The <var>bindings</var> of <code class="common-lisp library macro operator">setf-expanderlet</code> have much the same semantics as their counterparts in <code><a href="http://www.lispworks.com/documentation/HyperSpec/Body/s_flet_.htm">macrolet</a></code>, except the job of each expander is to return a <a href="http://www.lispworks.com/documentation/HyperSpec/Body/05_aab.htm">setf expansion</a> (5 values), not a normal expansion (a form).</p>
            <p>As an example of what <code class="common-lisp library macro operator">setf-expanderlet</code> can let one accomplish, <code class="common-lisp library macro operator">with-resolved-places</code> is trivially implemented in terms of it.</p>
            <p><b>Implementation note:</b> Surprisingly enough, this implementation of <code class="common-lisp library macro operator">setf-expanderlet</code> is written fully portably. As far as I can tell, the only caveat is that the name of the local setf-expander is unconditionally made a local macro. This macro, if used in a non-place context, simply expands to a form that evaluates the subforms and then reads the place.</p>
            <p>In contrast, "real" setf-expanders as defined by <code><a href="http://www.lispworks.com/documentation/HyperSpec/Body/m_defi_3.htm">define-setf-expander</a></code> don't affect the semantics of the operator in non-place contexts, which is useful if the operator is a function. However, if the original operator is simple enough that it's implemented as a function, you can probably just use a local setf function anyway so I don't think the aforementioned caveat is very important.</p>
          </dd>
        </dl>

      </section>

      <section id="with-resolved-places">

        <h1 class="breadcrumbs-bar">
          <span class="section-relative-nav">
            <a href="#with-resolved-places" class="anchor">⚓</a>
          </span>
          <span class="breadcrumbs">
            <a href="#">place-utils</a>
            <span class="crumb"><span class="s"> » </span><a class="here">with-resolved-places</a></span>
          </span>
{'fraction_non_alphanumeric': 0.1711505811675591, 'fraction_numerical': 0.003395585738539898, 'mean_word_length': 3.0677290836653386, 'pattern_counts': {'":': 0, '<': 533, '<?xml version=': 0, '>': 533, 'https://': 26, 'lorem ipsum': 0, 'www.': 32, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '297031', 'n_tokens_mistral': 4876, 'n_tokens_neox': 4665, 'n_words': 1097}