diff options
| author | 2022-09-14 17:20:28 -0400 | |
|---|---|---|
| committer | 2022-09-14 17:20:28 -0400 | |
| commit | 66cd9f045a26d6ea909825436a1f8942c78b44b0 (patch) | |
| tree | c1c5dfbe09f2ec8f77dbbbecb3a9163fb16710a3 | |
| parent | fix example bugs (diff) | |
fixed all SRFI examples
| -rw-r--r-- | srfi-225.html | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/srfi-225.html b/srfi-225.html index 66c6d63..ef1cc14 100644 --- a/srfi-225.html +++ b/srfi-225.html @@ -75,7 +75,7 @@ can be used to distinguish the two types.</p> 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> <p>Each of the following examples is assumed to be prefixed by the following definitions:</p> -<blockquote><pre>(define dict '((1 . 2) (3 . 4) (5 . 6)) +<blockquote><pre>(define dict '((1 . 2) (3 . 4) (5 . 6))) (define dto eqv-alist-dto) </pre></blockquote> Consequently, previous examples don't affect later ones. @@ -216,7 +216,7 @@ Otherwise, returns two values, a dictionary that contains ((1 . 3) (3 . 4) (5 . 6)) (dict-update/default dto dict 2 (lambda (x) (+ 1 x)) 0) => - ((1 . 0) (3 . 4) (5 . 6)) <b>FIXME</b> + ((2 . 1) (3 . 4) (5 . 6)) </pre></blockquote> <p><code>(dict-pop</code> <em>dto dict</em><code>)</code></p> <p>Chooses an association from <em>dict</em> and returns three values: @@ -256,8 +256,8 @@ key <em>key</em>. <p><code>(dict-map</code> <em>dto proc dict</em><code>)</code></p> <p>Returns a dictionary similar to <em>dict</em> that maps each of <em>dict</em> to the result of applying <em>proc</em> to the key and corresponding value of <em>dict</em>.</p> -<blockquote><pre>(dict-map dto (lambda (k v) (cons v k)) dict) => - ((2 . 1) (4 . 3) (6 . 5))</pre></blockquote> <b>FIXME</b> +<blockquote><pre>(dict-map dto (lambda (k v) (- v)) dict) => + (((1 . -2) (3 . -4) (5 . -6))</pre></blockquote> <p><code>(dict-filter</code> <em>dto pred dict</em><code>)</code></p> <code>(dict-remove</code> <em>dto pred dict</em><code>)</code></p> <p>Returns a dictionary similar to <em>dict</em> that contains @@ -265,8 +265,8 @@ key <em>key</em>. when it is invoked on the key and value of the association.</p> <blockquote><pre>(dict-filter dto (lambda (k v) (= k 1)) dict) => ((1 . 2)) -(dict-remove dto (lambda (k) (= k 1)) dict) => - ((3 . 4) (5 . 6))</pre></blockquote> <b>FIXME</b> +(dict-remove dto (lambda (k v) (= k 1)) dict) => + ((3 . 4) (5 . 6))</pre></blockquote> <h3 id="the-whole-dictionary">The whole dictionary</h3> <p><code>(dict-size</code> <em>dto dict</em><code>)</code></p> <p>Returns an exact integer representing the number of associations in <em>dict</em>.</p> @@ -274,7 +274,7 @@ key <em>key</em>. <p><code>(dict-count</code> <em>dto pred dict</em><code>)</code></p> <p>Passes each association of dictionary as two arguments to <em>pred</em> and returns the number of times that <em>pred</em> returned true as an an exact integer.</p> -<blockquote><pre>(dict-count dto dict (lambda (k v) (even? k))) => 0</pre></blockquote> <b>FIXME</b> +//blockquote><pre>(dict-count dto (lambda (k v) (even? k)) dict) => 0</pre></blockquote> <p><code>(dict-any</code> <em>dto pred dict</em><code>)</code></p> <p>Passes each association of <em>dict</em> as two arguments to <em>pred</em> and returns the value of the first call to <em>pred</em> that returns true, @@ -341,7 +341,7 @@ key <em>key</em>. They can can provide additional efficiency when iterating over part of the dictionary if the dictionary is ordered. The procedure returns an unspecified value.</p> <blockquote><pre>(define (write-key key value) (write key)) -(dict-for-each write-key dto dict) => unspecified +(dict-for-each dto write-key dict) => unspecified ; writes "135" to current output</pre></blockquote> <b>FIXME</b> <p><code>(dict->generator</code> <em>dto dict</em> [ <em>start</em> [ <em>end</em> ] ] <code>)</code></p> <p>Returns a <a href="https://srfi.schemers.org/srfi-158/srfi-158.html">SRFI 158 generator</a> |
