diff options
| author | 2021-11-20 21:33:09 -0500 | |
|---|---|---|
| committer | 2021-11-20 21:33:09 -0500 | |
| commit | dfa994e94fa5a8dbe09472ad258aee4aa125ad95 (patch) | |
| tree | e4ec4f04238b46b0aa40733719f8a539743cf74c | |
| parent | Merge remote-tracking branch 'upstream/master' (diff) | |
improved rationale
| -rw-r--r-- | srfi-225.html | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/srfi-225.html b/srfi-225.html index 893bd31..3e94c34 100644 --- a/srfi-225.html +++ b/srfi-225.html @@ -48,7 +48,8 @@ None at present. <p>It’s inconvenient for users if SRFIs or other libraries have to insist on accepting only a specific type of dictionary. This SRFI exposes a number of accessors, updaters, and other procedures that can be called on any dictionary, provided that a <em>dictionary type descriptor</em> (DTD, with apologies to SGML and XML users) is available for it: either exported from this SRFI, or from other SRFIs or libraries, or created by the user. DTDs are of an unspecified type.</p> <p>This in turn requires that the DTD provides a predicate that can recognize its dictionaries, plus several primitive generic procedures.</p> <p>By using the procedures of this SRFI, a procedure can take a DTD and a dictionary as an argument and make flexible use of the dictionary without knowing its exact type. For the purposes of this SRFI, such a procedure is called a <em>generic procedure</em>. However, it is still necessary to distinguish between pure and impure dictionary types. A pure dictionary type either exposes pure functional update operations or no update operations at all, whereas an impure dictionary type exposes mutation operations. Note that if an instance of an impure dictionary type like SRFI 126 is in fact immutable, it still counts as impure. -<p>In addition, dictionaries need to be constructed using type-specific constructors, as the required and optional arguments differ in each case. In addition, the dictionary type provided by the caller of a generic procedure doesn't necessarily have the right performance characteristics needed by the generic procedure itself. Consequently there are no <code>make-dict</code>, <code>dict</code>, <code>dict-unfold</code>, <code>dict-copy</code>, or similar procedures in this SRFI.</p> +<p>The <code>dict-pure?</code> procedure depends only on the <em>dtd</em> argument and ignores the <i>dict</i> argument except for possibly checking that the arguments taken together satisfy <code>dictionary?</code>. This is done to maintain uniformity between <i>dict-pure?</i> and the other generic procedures, both at the point of call and when <i>make-dtd</i>is invoked.</p> +<p>In addition, dictionaries need to be constructed using type-specific constructors, as the required and optional arguments differ in each case. In addition, the dictionary type provided by the caller of a generic procedure doesn't necessarily have the right performance characteristics needed by the generic procedure itself. Consequently there are no <code>make-dict</code>, <code>dict</code>, <code>dict-unfold</code>, <code>dict-copy</code>, or similar procedures provided by this SRFI.</p> <h2 id="specification">Specification</h2> <p>We call a specific key-value combination an <em>association</em>. This is why an alist, or association list, is called that; it is a list of associations represented as pairs.</p> <p>A <em>dictionary</em> or <em>dict</em> is a collection of associations which may be ordered or unordered. In principle an <em>equality predicate</em> is enough, given a key, to determine whether an association with that key exists in the dictionary. However, for efficiency most dictionaries require an <em>ordering predicate</em> or a <em>hash function</em> as well. |
