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

📄 unit-library.html

📁 Scheme跨平台编译器
💻 HTML
📖 第 1 页 / 共 3 页
字号:
(char-name 'bell (integer-&gt;char 7))(char-name 'bell)                   =<B><FONT COLOR="#A020F0">=&gt;</FONT></B> #\bell(char-&gt;integer (char-name 'bell))   =<B><FONT COLOR="#A020F0">=&gt;</FONT></B> 7</PRE><a name="blobs"></a><h2>Blobs</h2><p>"blobs" are collections of unstructured bytes. You can't do much with them, but allow conversion to and from SRFI-4 number vectors.</p><a name="make-blob"></a><h3>make-blob</h3><pre>[procedure] (make-blob SIZE)</pre><p>Returns a blob object of <tt>SIZE</tt> bytes, aligned on an 8-byte boundary, uninitialized.</p><a name="blob"></a><h3>blob?</h3><pre>[procedure] (blob? X)</pre><p>Returns <tt>#t</tt> if <tt>X</tt> is a blob object, or <tt>#f</tt> otherwise.</p><a name="blob-size"></a><h3>blob-size</h3><pre>[procedure] (blob-size BLOB)</pre><p>Returns the number of bytes in <tt>BLOB</tt>.</p><a name="blob-string"></a><h3>blob&rarr;string</h3><pre>[procedure] (blob-&gt;string BLOB)</pre><p>Returns a string with the contents of <tt>BLOB</tt>.</p><a name="string-blob"></a><h3>string&rarr;blob</h3><pre>[procedure] (string-&gt;blob STRING)</pre><p>Returns a blob with the contents of <tt>STRING</tt>.</p><a name="blob"></a><h3>blob=?</h3><pre>[procedure] (blob=? BLOB1 BLOB2)</pre><p>Returns <tt>#t</tt> if the two argument blobs are of the same size and have the same content.</p><a name="vectors"></a><h2>Vectors</h2><a name="vector-copy"></a><h3>vector-copy!</h3><pre>[procedure] (vector-copy! VECTOR1 VECTOR2 [COUNT])</pre><p>Copies contents of <tt>VECTOR1</tt> into <tt>VECTOR2</tt>. If the argument <tt>COUNT</tt> is given, it specifies the maximal number of elements to be copied. If not given, the minimum of the lengths of the argument vectors is copied.</p><p>Exceptions: <tt>(exn bounds)</tt></p><a name="vector-resize"></a><h3>vector-resize</h3><pre>[procedure] (vector-resize VECTOR N [INIT])</pre><p>Creates and returns a new vector with the contents of <tt>VECTOR</tt> and length <tt>N</tt>. If <tt>N</tt> is greater than the original length of <tt>VECTOR</tt>, then all additional items are initialized to <tt>INIT</tt>. If <tt>INIT</tt> is not specified, the contents are initialized to some unspecified value.</p><a name="the-unspecified-value"></a><h2>The unspecified value</h2><a name="void"></a><h3>void</h3><pre>[procedure] (void)</pre><p>Returns an unspecified value.</p><a name="continuations"></a><h2>Continuations</h2><a name="call-cc"></a><h3>call/cc</h3><pre>[procedure] (call/cc PROCEDURE)</pre><p>An alias for <tt>call-with-current-continuation</tt>.</p><a name="continuation-capture"></a><h3>continuation-capture</h3><pre>[procedure] (continuation-capture PROCEDURE)</pre><p>Creates a continuation object representing the current continuation and tail-calls <tt>PROCEDURE</tt> with this continuation as the single argument.</p><p>More information about this continuation API can be found in the paper <a href="http://repository.readscheme.org/ftp/papers/sw2001/feeley.pdf" class="external">http://repository.readscheme.org/ftp/papers/sw2001/feeley.pdf</a> <em>A Better API for first class Continuations</em> by Marc Feeley.</p><a name="continuation"></a><h3>continuation?</h3><pre>[procedure] (continuation? X)</pre><p>Returns <tt>#t</tt> if <tt>X</tt> is a continuation object, or <tt>#f</tt> otherwise. Please note that this applies only to continuations created by the Continuation API, but not by call/cc, i.e.: <tt>(call-with-current-continuation continuation?)</tt> returns <tt>#f</tt>, whereas <tt>(continuation-capture continuation?)</tt> returns <tt>#t</tt>.</p><a name="continuation-graft"></a><h3>continuation-graft</h3><pre>[procedure] (continuation-graft CONT THUNK)</pre><p>Calls the procedure <tt>THUNK</tt> with no arguments and the implicit continuation <tt>CONT</tt>.</p><a name="continuation-return"></a><h3>continuation-return</h3><pre>[procedure] (continuation-return CONT VALUE ...)</pre><p>Returns the value(s) to the continuation <tt>CONT</tt>. <tt>continuation-return</tt> could be implemented like this:</p><PRE>(<B><FONT COLOR="#A020F0">define</FONT></B> (<B><FONT COLOR="#0000FF">continuation-return</FONT></B> k . vals)  (continuation-graft    k    (<B><FONT COLOR="#A020F0">lambda</FONT></B> () (apply values vals)) ) )</PRE><a name="setters"></a><h2>Setters</h2><p>SRFI-17 is fully implemented. For more information see: <a href="http://srfi.schemers.org/srfi-17/srfi-17.html" class="external">SRFI-17</a>.</p><a name="setter"></a><h3>setter</h3><pre>[procedure] (setter PROCEDURE)</pre><p>Returns the setter-procedure of <tt>PROCEDURE</tt>, or signals an error if <tt>PROCEDURE</tt> has no associated setter-procedure.</p><p>Note that <tt>(set! (setter PROC) ...)</tt> for a procedure that has no associated setter procedure yet is a very slow operation (the old procedure is replaced by a modified copy, which involves a garbage collection).</p><a name="getter-with-setter"></a><h3>getter-with-setter</h3><pre>[procedure] (getter-with-setter GETTER SETTER)</pre><p>Returns a copy of the procedure <tt>GETTER</tt> with the associated setter procedure <tt>SETTER</tt>. Contrary to the SRFI specification, the setter of the returned procedure may be changed.</p><a name="reader-extensions"></a><h2>Reader extensions</h2><a name="define-reader-ctor"></a><h3>define-reader-ctor</h3><pre>[procedure] (define-reader-ctor SYMBOL PROC)</pre><p>Define new read-time constructor for <tt>#,</tt> read syntax. For further information, see the documentation for <a href="http://srfi.schemers.org/srfi-10/srfi-10.html" class="external">SRFI-10</a>.</p><a name="set-read-syntax"></a><h3>set-read-syntax!</h3><pre>[procedure] (set-read-syntax! CHAR-OR-SYMBOL PROC)</pre><p>When the reader encounters the non-whitespace character <tt>CHAR</tt> while reading an expression from a given port, then the procedure <tt>PROC</tt> will be called with that port as its argument. The procedure should return a value that will be returned to the reader:</p><PRE> <I><FONT COLOR="#B22222">; A simple RGB color syntax:</FONT></I> (set-read-syntax! #\%   (<B><FONT COLOR="#A020F0">lambda</FONT></B> (port)     (apply vector       (map (cut string-&gt;number &lt;&gt; 16)	    (string-chop (read-string 6 port) 2) ) ) ) ) (with-input-from-string <B><FONT COLOR="#BC8F8F">&quot;(1 2 %f0f0f0 3)&quot;</FONT></B> read) <I><FONT COLOR="#B22222">; ==&gt; (1 2 #(240 240 240) 3)</FONT></I></PRE><p>If <tt>CHAR-OR-SYMBOL</tt> is a symbol, then a so-called <em>read-mark</em> handler is defined. In that case the handler procedure will be called when a character-sequence of the form</p><pre>#!SYMBOL</pre><p>is encountered.</p><p>You can undo special handling of read-syntax by passing <tt>#f</tt> as the second argument (if the syntax was previously defined via <tt>set-read-syntax!</tt>).</p><p>Note that all of CHICKEN's special non-standard read-syntax is handled directly by the reader. To disable built-in read-syntax, define a handler that triggers an error (for example).</p><a name="set-sharp-read-syntax"></a><h3>set-sharp-read-syntax!</h3><pre>[procedure] (set-sharp-read-syntax! CHAR-OR-SYMBOL PROC)</pre><p>Similar to <tt>set-read-syntax!</tt>, but allows defining new <tt>#&lt;CHAR&gt; ...</tt> reader syntax. If the first argument is a symbol, then this procedure is equivalent to <tt>set-read-syntax!</tt>.</p><a name="set-parameterized-read-syntax"></a><h3>set-parameterized-read-syntax!</h3><pre>[procedure] (set-parameterized-read-syntax! CHAR-OR-SYMBOL PROC)</pre><p>Similar to <tt>set-sharp-read-syntax!</tt>, but intended for defining reader syntax of the form <tt>#&lt;NUMBER&gt;&lt;CHAR&gt; ...</tt>. The handler procedure <tt>PROC</tt> will be called with two arguments: the input port and the number preceding the dispatching character. If the first argument is a symbol, then this procedure is equivalent to <tt>set-read-syntax!</tt>.</p><a name="copy-read-table"></a><h3>copy-read-table</h3><pre>[procedure] (copy-read-table READ-TABLE)</pre><p>Returns a copy of the given read-table. You can access the currently active read-table with <tt>(current-read-table)</tt>.</p><a name="property-lists"></a><h2>Property lists</h2><p>As in other Lisp dialects, CHICKEN supports "property lists" associated with symbols. Properties are accessible via a key that can be any kind of value but which will be compared using <tt>eq?</tt>.</p><a name="get"></a><h3>get</h3><pre> [procedure] (get SYMBOL PROPERTY [DEFAULT])</pre><p>Returns the value stored under the key <tt>PROPERTY</tt> in the property list of <tt>SYMBOL</tt>. If no such property is stored, returns <tt>DEFAULT</tt>. The <tt>DEFAULT</tt> is optional and defaults to <tt>#f</tt>.</p><a name="put"></a><h3>put!</h3><pre> [procedure] (put! SYMBOL PROPERTY VALUE) [setter] (set! (get SYMBOL PROPERTY) VALUE)</pre><p>Stores <tt>VALUE</tt> under the key <tt>PROPERTY</tt> in the property list of <tt>SYMBOL</tt> replacing any previously stored value.</p><a name="remprop"></a><h3>remprop!</h3><pre> [procedure] (remprop! SYMBOL PROPERTY)</pre><p>Deletes the first property matching the key <tt>PROPERTY</tt> in the property list of <tt>SYMBOL</tt>. Returns <tt>#t</tt> when a deletion performed, and <tt>#f</tt> otherwise.</p><a name="symbol-plist"></a><h3>symbol-plist</h3><pre> [procedure] (symbol-plist SYMBOL) [setter] (set! (symbol-plist SYMBOL) LST)</pre><p>Returns the property list of <tt>SYMBOL</tt> or sets it.</p><a name="get-properties"></a><h3>get-properties</h3><pre> [procedure] (get-properties SYMBOL PROPERTIES)</pre><p>Searches the property list of <tt>SYMBOL</tt> for the first property with a key in the list <tt>PROPERTIES</tt>. Returns 3 values: the matching property key, value, and the tail of property list after the matching property. When no match found all values are <tt>#f</tt>.</p><p><tt>PROPERTIES</tt> may also be an atom, in which case it is treated as a list of one element.</p><p>Previous: <a href="parameters.html" class="internal">Parameters</a></p><p>Next: <a href="unit-eval.html" class="internal">Unit eval</a></p></body></html>

⌨️ 快捷键说明

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