diff options
| author | 2021-10-04 18:22:58 -0400 | |
|---|---|---|
| committer | 2021-10-04 18:22:58 -0400 | |
| commit | e729ebd927ae52a5d3c383104a3d5402c2defe6e (patch) | |
| tree | 6816b9a2d2911de6e6353a1c2bc14060604ae2d4 | |
| parent | draft 4 (diff) | |
| parent | Publish third draft. (diff) | |
resolved against upstream
| -rw-r--r-- | srfi-225.html | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/srfi-225.html b/srfi-225.html index 148bcc2..86aa538 100644 --- a/srfi-225.html +++ b/srfi-225.html @@ -19,6 +19,7 @@ <li>60-day deadline: 2021-09-16</li> <li>Draft #1 published: 2021-07-18</li> <li>Draft #2 published: 2021-07-26</li> + <li>Draft #3 published: 2021-08-07</li> <li>John Cowan's <a href="https://github.com/pre-srfi/dictionaries">personal Git repo for this SRFI</a> for reference while the SRFI is in <em>draft</em> status (<a href="https://htmlpreview.github.io/?https://github.com/johnwcowan/srfi-225/blob/master/srfi-225.html">preview</a>)</li> @@ -174,6 +175,15 @@ Otherwise, returns two values, a dictionary that contains all the associations o <p>This procedure is a workhorse for dictionary lookup, insert, and delete. The dictionary <em>dict</em> is searched for an association whose key is the same as <em>key</em>. If one is not found, then the <em>failure</em> procedure is tail-called with two procedure arguments, <em>insert</em> and <em>ignore</em>.</p> <p>If such an association is found, then the <em>success</em> procedure is tail-called with the matching key of <em>dict</em>, the associated value, and two procedure arguments, <em>update</em> and <em>remove</em>.</p> <p>In either case, the values returned by <em>failure</em> or <em>success</em> are returned.</p> +<code>(dict-remove!</code> <em>dtd pred dictionary</em><code>)</code></p> +<p>Returns a dictionary similar to <em>dictionary</em> that contains just the associations of <em>dictionary</em> that satisfy / do not satisfy <em>pred</em> when it is invoked on the key and value of the association.</p> +<blockquote><pre>(dict-filter (lambda (k v) (= k 1)) aed dict) => ((1 . 2)) +(dict-remove (lambda (k) (= k 1)) aed dict) => ((3 . 4) (5 . 6))</pre></blockquote> +<p><code>(dict-search</code> <em>dtd dictionary key failure success</em><code>)</code><br> +<code>(dict-search!</code> <em>dtd dictionary key failure success</em><code>)</code></p> +<p>This procedure is a workhorse for dictionary lookup, insert, and delete. The dictionary <em>dictionary</em> is searched for an association whose key is the same as <em>key</em> in the sense of <em>dictionary</em>. If one is not found, then the <em>failure</em> procedure is tail-called with two procedure arguments, <em>insert</em> and <em>ignore</em>, and is expected to tail-call one of them.</p> +<p>However, if such an association is found, then the <em>success</em> procedure is tail-called with the matching key of <em>dictionary</em>, the associated value, and two procedure arguments, <em>update</em> and <em>remove</em>, and is expected to tail-call one of them.</p> +<p>It is an error if the procedure arguments are invoked other than in tail position in the <em>failure</em> and <em>success</em> procedures. It is also an error if the <em>failure</em> and <em>success</em> procedures return to their implicit continuation without invoking one of their arguments.</p> <p>The behaviors of the procedures are as follows (where <em>obj</em> is any Scheme object):</p> <ul> <li><p>Invoking <code>(</code><em>insert value</em><code>)</code> returns a dictionary that contains all the associations of <em>dict</em>, and in addition a new association that maps <em>key</em> to <em>value</em>.</p></li> |
