diff options
author | Arthur A. Gleckler <srfi@speechcode.com> | 2020-10-07 09:45:05 -0700 |
---|---|---|
committer | Arthur A. Gleckler <srfi@speechcode.com> | 2020-10-07 09:51:20 -0700 |
commit | 56fec159a8e435fd66b6b0dad6022968a6fe34e6 (patch) | |
tree | eec566a78b7ccdcd9fca7493dce00c051ec1c16e /srfi-flexvectors.html | |
parent | baf35d5206a4ce1d05e0ccff5e6715c432dd6b89 (diff) | |
download | srfi-214-56fec159a8e435fd66b6b0dad6022968a6fe34e6.tar.gz srfi-214-56fec159a8e435fd66b6b0dad6022968a6fe34e6.tar.xz srfi-214-56fec159a8e435fd66b6b0dad6022968a6fe34e6.zip |
copy edit
Diffstat (limited to 'srfi-flexvectors.html')
-rw-r--r-- | srfi-flexvectors.html | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/srfi-flexvectors.html b/srfi-flexvectors.html index a1c0af3..3626b21 100644 --- a/srfi-flexvectors.html +++ b/srfi-flexvectors.html @@ -235,7 +235,7 @@ zot <div class="copy-wrapper"><pre><code class="language-scheme"><span><span class="mtk1">(flexvector-skip number? (flexvector </span><span class="mtk21">1</span><span class="mtk1"> </span><span class="mtk21">2</span><span class="mtk1"> 'a 'b </span><span class="mtk21">3</span><span class="mtk1"> </span><span class="mtk21">4</span><span class="mtk1"> 'c 'd))</span></span><br><span><span class="mtk4">;=> 2</span></span><br><span><span> </span></span><br><span><span class="mtk1">(flexvector-skip-right number? (flexvector </span><span class="mtk21">1</span><span class="mtk1"> </span><span class="mtk21">2</span><span class="mtk1"> 'a 'b </span><span class="mtk21">3</span><span class="mtk1"> </span><span class="mtk21">4</span><span class="mtk1"> 'c 'd))</span></span><br><span><span class="mtk4">;=> 4</span></span><br></code></pre></div> <h4 id="flexvector-binary-search"><code>flexvector-binary-search</code></h4> <p><code>(flexvector-binary-search fv value cmp [start [end]])</code></p> -<p>Similar to <code>flexvector-index</code> and <code>flexvector-index-right</code>, but, instead of searching left-to-right or right-to-left, this performs a binary search. If there is more than one element of <code>fv</code> that matches <code>value</code> in the sense of <code>cmp</code>, <code>flexvector-binary-search</code> may return the index of any of them.</p> +<p>Similar to <code>flexvector-index</code> and <code>flexvector-index-right</code>, but instead of searching left-to-right or right-to-left, this performs a binary search. If there is more than one element of <code>fv</code> that matches <code>value</code> in the sense of <code>cmp</code>, <code>flexvector-binary-search</code> may return the index of any of them.</p> <p>The search is performed on only the indexes of <code>fv</code> between <code>start</code>, which defaults to 0, and <code>end</code>, which defaults to the length of <code>fv</code>. Both <code>start</code> and <code>end</code> are clamped to the range [0, <code>(flexvector-length fv)</code>]. It is an error if <code>end</code> is less than <code>start</code>.</p> <p><code>cmp</code> should be a procedure of two arguments that returns either a negative integer, which indicates that its first argument is less than its second; zero, which indicates that they are equal; or a positive integer, which indicates that the first argument is greater than the second argument. An example <code>cmp</code> might be:</p> <div class="copy-wrapper"><pre><code class="language-scheme"><span><span class="mtk1">(λ (char1 char2)</span></span><br><span><span class="mtk1"> (</span><span class="mtk12">cond</span><span class="mtk1"> ((char<? char1 char2) </span><span class="mtk21">-1</span><span class="mtk1">)</span></span><br><span><span class="mtk1"> ((char=? char1 char2) </span><span class="mtk21">0</span><span class="mtk1">)</span></span><br><span><span class="mtk1"> (</span><span class="mtk12">else</span><span class="mtk1"> </span><span class="mtk21">1</span><span class="mtk1">))) </span></span><br></code></pre></div> |