⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit-srfi-69.html

📁 Scheme跨平台编译器
💻 HTML
字号:
<html><head><title>CHICKEN User's Manual - Unit srfi-69</title></head><body><p> </p><a name="unit-srfi-69"></a><h1>Unit srfi-69</h1><p>CHICKEN implements SRFI 69 with SRFI 90 extensions. For more information, see <a href="http://srfi.schemers.org/srfi-69/srfi-69.html" class="external">SRFI-69</a> and <a href="http://srfi.schemers.org/srfi-90/srfi-90.html" class="external">SRFI-90</a>.</p><a name="hash-table-procedures"></a><h2>Hash Table Procedures</h2><a name="make-hash-table"></a><h3>make-hash-table</h3><pre>[procedure] (make-hash-table [TEST HASH SIZE] #:TEST #:HASH #:SIZE #:INITIAL #:MIN-LOAD #:MAX-LOAD #:WEAK-KEYS #:WEAK-VALUES)</pre><p>Returns a new <tt>HASH-TABLE</tt> with the supplied configuration.</p><dl><dt><tt>TEST</tt></dt><dd>The equivalence function.</dd><dt><tt>HASH</tt></dt><dd>The hash function.</dd><dt><tt>SIZE</tt></dt><dd>The expected number of table elements.</dd><dt><tt>INITIAL</tt></dt><dd>The default initial value.</dd><dt><tt>MIN-LOAD</tt></dt><dd>The minimum load factor. A <tt>flonum</tt> in (0.0 1.0).</dd><dt><tt>MAX-LOAD</tt></dt><dd>The maximum load factor. A <tt>flonum</tt> in (0.0 1.0).</dd><dt><tt>WEAK-KEYS</tt></dt><dd>Use weak references for keys. (Ignored)</dd><dt><tt>WEAK-VALUES</tt></dt><dd>Use weak references for values. (Ignored)</dd></dl><p>(No, the keyword parameters are not uppercase.)</p><a name="hash-table"></a><h3>hash-table?</h3><pre>[procedure] (hash-table? OBJECT)</pre><p>Is the <tt>OBJECT</tt> a <tt>hash-table</tt>?</p><a name="hash-table-size"></a><h3>hash-table-size</h3><pre>[procedure] (hash-table-size HASH-TABLE)</pre><p>The <tt>HASH-TABLE</tt> size.</p><a name="hash-table-equivalence-function"></a><h3>hash-table-equivalence-function</h3><pre>[procedure] (hash-table-equivalence-function HASH-TABLE)</pre><p>The <tt>HASH-TABLE</tt> <tt>equivalence-function</tt>.</p><a name="hash-table-hash-function"></a><h3>hash-table-hash-function</h3><pre>[procedure] (hash-table-hash-function HASH-TABLE)</pre><p>The <tt>HASH-TABLE</tt> <tt>hash-function</tt>.</p><a name="hash-table-min-load"></a><h3>hash-table-min-load</h3><pre>[procedure] (hash-table-min-load HASH-TABLE)</pre><p>The <tt>HASH-TABLE</tt> minimum load factor.</p><a name="hash-table-max-load"></a><h3>hash-table-max-load</h3><pre>[procedure] (hash-table-max-load HASH-TABLE)</pre><p>The <tt>HASH-TABLE</tt> maximum load factor.</p><a name="hash-table-weak-keys"></a><h3>hash-table-weak-keys</h3><pre>[procedure] (hash-table-weak-keys HASH-TABLE)</pre><p>Does the <tt>HASH-TABLE</tt> weak references for keys?</p><a name="hash-table-weak-values"></a><h3>hash-table-weak-values</h3><pre>[procedure] (hash-table-weak-values HASH-TABLE)</pre><p>Does the <tt>HASH-TABLE</tt> weak references for values?</p><a name="hash-table-has-initial"></a><h3>hash-table-has-initial?</h3><pre>[procedure] (hash-table-has-initial? HASH-TABLE)</pre><p>Does the <tt>HASH-TABLE</tt> have a default initial value?</p><a name="hash-table-initial"></a><h3>hash-table-initial</h3><pre>[procedure] (hash-table-initial HASH-TABLE)</pre><p>The <tt>HASH-TABLE</tt> default initial value.</p><a name="hash-table-keys"></a><h3>hash-table-keys</h3><pre>[procedure] (hash-table-keys HASH-TABLE)</pre><p>Returns a list of the keys in the <tt>HASH-TABLE</tt> population.</p><a name="hash-table-values"></a><h3>hash-table-values</h3><pre>[procedure] (hash-table-values HASH-TABLE)</pre><p>Returns a list of the values in the <tt>HASH-TABLE</tt> population.</p><a name="hash-table-alist"></a><h3>hash-table&rarr;alist</h3><pre>[procedure] (hash-table-&gt;alist HASH-TABLE)</pre><p>Returns the population of the <tt>HASH-TABLE</tt> as an <tt>association-list</tt>.</p><a name="alist-hash-table"></a><h3>alist&rarr;hash-table</h3><pre>[procedure] (alist-&gt;hash-table ASSOCIATION-LIST [MAKE-HASH-TABLE-PARAMETER ...])</pre><p>Returns a new <tt>HASH-TABLE</tt>, configured using the optional <tt>MAKE-HASH-TABLE-PARAMETER ...</tt>. The <tt>HASH-TABLE</tt> is populated from the <tt>ASSOCIATION-LIST</tt>.</p><a name="hash-table-ref"></a><h3>hash-table-ref</h3><pre>[procedure] (hash-table-ref HASH-TABLE KEY)</pre><p>Returns the <tt>VALUE</tt> for the <tt>KEY</tt> in the <tt>HASH-TABLE</tt>.</p><p>Aborts with an exception when the <tt>KEY</tt> is missing.</p><a name="hash-table-ref-default"></a><h3>hash-table-ref/default</h3><pre>[procedure] (hash-table-ref/default HASH-TABLE KEY DEFAULT)</pre><p>Returns the <tt>VALUE</tt> for the <tt>KEY</tt> in the <tt>HASH-TABLE</tt>, or the <tt>DEFAULT</tt> when the <tt>KEY</tt> is missing.</p><a name="hash-table-exists"></a><h3>hash-table-exists?</h3><pre>[procedure] (hash-table-exists? HASH-TABLE KEY)</pre><p>Does the <tt>KEY</tt> exist in the <tt>HASH-TABLE</tt>?</p><a name="hash-table-set"></a><h3>hash-table-set!</h3><pre>[procedure] (hash-table-set! HASH-TABLE KEY VALUE)</pre><p>Set the <tt>VALUE</tt> for the <tt>KEY</tt> in the <tt>HASH-TABLE</tt>.</p><p>A setter for <tt>hash-table-ref</tt> is defined, so</p><PRE>(<B><FONT COLOR="#A020F0">set!</FONT></B> (hash-table-ref HASH-TABLE KEY) VALUE)</PRE><p>is equivalent to</p><PRE>(hash-table-set! HASH-TABLE KEY VALUE)</PRE><a name="hash-table-update"></a><h3>hash-table-update!</h3><pre>[procedure] (hash-table-update! HASH-TABLE KEY [UPDATE-FUNCTION [DEFAULT-VALUE-FUNCTION]])</pre><p>Sets or replaces the <tt>VALUE</tt> for <tt>KEY</tt> in the <tt>HASH-TABLE</tt>.</p><p>The <tt>UPDATE-FUNCTION</tt> takes the existing <tt>VALUE</tt> for <tt>KEY</tt> and returns the new <tt>VALUE</tt>. The default is <tt>identity</tt></p><p>The <tt>DEFAULT-VALUE-FUNCTION</tt> is called when the entry for <tt>KEY</tt> is missing. The default uses the <tt>(hash-table-initial-value)</tt>, if provided. Otherwise aborts with an exception.</p><p>Returns the new <tt>VALUE</tt>.</p><a name="hash-table-update-default"></a><h3>hash-table-update!/default</h3><pre>[procedure] (hash-table-update! HASH-TABLE KEY UPDATE-FUNCTION DEFAULT-VALUE)</pre><p>Sets or replaces the <tt>VALUE</tt> for <tt>KEY</tt> in the <tt>HASH-TABLE</tt>.</p><p>The <tt>UPDATE-FUNCTION</tt> takes the existing <tt>VALUE</tt> for <tt>KEY</tt> and returns the new <tt>VALUE</tt>.</p><p>The <tt>DEFAULT-VALUE</tt> is used when the entry for <tt>KEY</tt> is missing.</p><p>Returns the new <tt>VALUE</tt>.</p><a name="hash-table-copy"></a><h3>hash-table-copy</h3><pre>[procededure] (hash-table-copy HASH-TABLE)</pre><p>Returns a shallow copy of the <tt>HASH-TABLE</tt>.</p><a name="hash-table-delete"></a><h3>hash-table-delete!</h3><pre>[procedure] (hash-table-delete! HASH-TABLE KEY)</pre><p>Deletes the entry for <tt>KEY</tt> in the <tt>HASH-TABLE</tt>.</p><a name="hash-table-remove"></a><h3>hash-table-remove!</h3><pre>[procedure] (hash-table-remove! HASH-TABLE PROC)</pre><p>Calls <tt>PROC</tt> for all entries in <tt>HASH-TABLE</tt> with the key and value of each entry. If <tt>PROC</tt> returns true, then that entry is removed.</p><a name="hash-table-clear"></a><h3>hash-table-clear!</h3><pre>[procedure] (hash-table-clear! HASH-TABLE)</pre><p>Deletes all entries in <tt>HASH-TABLE</tt>.</p><a name="hash-table-merge"></a><h3>hash-table-merge</h3><pre>[procedure] (hash-table-merge HASH-TABLE-1 HASH-TABLE-2)</pre><p>Returns a new <tt>HASH-TABLE</tt> with the union of <tt>HASH-TABLE-1</tt> and <tt>HASH-TABLE-2</tt>.</p><a name="hash-table-merge"></a><h3>hash-table-merge!</h3><pre>[procedure] (hash-table-merge! HASH-TABLE-1 HASH-TABLE-2)</pre><p>Returns <tt>HASH-TABLE-1</tt> as the union of <tt>HASH-TABLE-1</tt> and <tt>HASH-TABLE-2</tt>.</p><a name="hash-table-map"></a><h3>hash-table-map</h3><pre>[procedure] (hash-table-map HASH-TABLE FUNC)</pre><p>Calls <tt>FUNC</tt> for all entries in <tt>HASH-TABLE</tt> with the key and value of each entry.</p><p>Returns a list of the results of each call.</p><a name="hash-table-fold"></a><h3>hash-table-fold</h3><pre>[procedure] (hash-table-fold HASH-TABLE FUNC INIT)</pre><p>Calls <tt>FUNC</tt> for all entries in <tt>HASH-TABLE</tt> with the key and value of each entry, and the current folded value. The initial folded value is <tt>INIT</tt>.</p><p>Returns the final folded value.</p><a name="hash-table-for-each"></a><h3>hash-table-for-each</h3><pre>[procedure] (hash-table-for-each HASH-TABLE PROC)</pre><p>Calls <tt>PROC</tt> for all entries in <tt>HASH-TABLE</tt> with the key and value of each entry.</p><a name="hash-table-walk"></a><h3>hash-table-walk</h3><pre>[procedure] (hash-table-walk HASH-TABLE PROC)</pre><p>Calls <tt>PROC</tt> for all entries in <tt>HASH-TABLE</tt> with the key and value of each entry.</p><a name="hashing-functions"></a><h2>Hashing Functions</h2><p>All hash functions return a <tt>fixnum</tt> in the range [0 <tt>BOUND</tt>).</p><a name="number-hash"></a><h3>number-hash</h3><pre>[procedure] (number-hash NUMBER [BOUND])</pre><p>For use with <tt>=</tt> as a <tt>hash-table-equivalence-function</tt>.</p><a name="object-uid-hash"></a><h3>object-uid-hash</h3><pre>[procedure] (object-uid-hash OBJECT [BOUND])</pre><p>Currently a synonym for <tt>equal?-hash</tt>.</p><a name="symbol-hash"></a><h3>symbol-hash</h3><pre>[procedure] (symbol-hash SYMBOL [BOUND])</pre><p>For use with <tt>eq?</tt> as a <tt>hash-table-equivalence-function</tt>.</p><a name="keyword-hash"></a><h3>keyword-hash</h3><pre>[procedure] (keyword-hash KEYWORD [BOUND])</pre><p>For use with <tt>eq?</tt> as a <tt>hash-table-equivalence-function</tt>.</p><a name="string-hash"></a><h3>string-hash</h3><pre>[procedure] (string-hash STRING [BOUND])</pre><p>For use with <tt>string=?</tt> as a <tt>hash-table-equivalence-function</tt>.</p><a name="string-ci-hash"></a><h3>string-ci-hash</h3><pre>[procedure] (string-ci-hash STRING [BOUND])</pre><p>For use with <tt>string-ci=?</tt> as a <tt>hash-table-equivalence-function</tt>.</p><a name="eq-hash"></a><h3>eq?-hash</h3><pre>[procedure] (eq?-hash OBJECT [BOUND])</pre><p>For use with <tt>eq?</tt> as a <tt>hash-table-equivalence-function</tt>.</p><a name="eqv-hash"></a><h3>eqv?-hash</h3><pre>[procedure] (eqv?-hash OBJECT [BOUND])</pre><p>For use with <tt>eqv?</tt> as a <tt>hash-table-equivalence-function</tt>.</p><a name="equal-hash"></a><h3>equal?-hash</h3><pre>[procedure] (equal?-hash OBJECT [BOUND])</pre><p>For use with <tt>equal?</tt> as a <tt>hash-table-equivalence-function</tt>.</p><a name="hash"></a><h3>hash</h3><pre>[procedure] (hash OBJECT [BOUND])</pre><p>Synonym for <tt>equal?-hash</tt>.</p><a name="hash-by-identity"></a><h3>hash-by-identity</h3><pre>[procedure] (hash-by-identity OBJECT [BOUND])</pre><p>Synonym for <tt>eq?-hash</tt>.</p><p>Previous: <a href="unit-srfi-14.html" class="internal">Unit srfi-14</a> Next: <a href="unit-match.html" class="internal">Unit match</a></p></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -