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

📄 unit-utils.html

📁 Scheme跨平台编译器
💻 HTML
字号:
<html><head><title>CHICKEN User's Manual - Unit utils</title></head><body><p> </p><a name="unit-utils"></a><h1>Unit utils</h1><p>This unit contains apropos and functions as a "grab bag" of procedures without a good home, and which don't have to be available by default (as compared to the <a href="http://galinha.ucpel.tche.br/Unit extras" class="external">extras</a> unit).</p><p>This unit uses the <tt>extras</tt> and <tt>regex</tt> units.</p><a name="environment-query"></a><h2>Environment Query</h2><a name="apropos"></a><h3>apropos</h3><pre>[procedure] (apropos SYMBOL-PATTERN [ENVIRONMENT] [#:MACROS?])</pre><p>Displays symbols &amp; type matching <tt>SYMBOL-PATTERN</tt> in the <tt>ENVIRONMENT</tt> on the <tt>(current-output-port)</tt>.</p><dl><dt><tt>SYMBOL-PATTERN</tt></dt><dd>A symbol, string, or regex. When symbol or string substring matching is performed.</dd><dt><tt>ENVIRONMENT</tt></dt><dd>An environment. When missing the <tt>(interaction-environment)</tt> is assumed.</dd><dt><tt>#:MACROS?</tt></dt><dd>Keyword argument. A boolean. Include macro symbols? When missing <tt>#f</tt> is assumed.</dd></dl><a name="apropos-list"></a><h3>apropos-list</h3><pre>[procedure] (apropos-list SYMBOL-PATTERN [ENVIRONMENT] [#:MACROS?])</pre><p>Like <tt>apropos</tt> but returns a list of matching symbols.</p><a name="iterating-over-input-lines-and-files"></a><h2>Iterating over input lines and files</h2><a name="for-each-line"></a><h3>for-each-line</h3><pre>[procedure] (for-each-line PROCEDURE [PORT])</pre><p>Calls <tt>PROCEDURE</tt> for each line read from <tt>PORT</tt> (which defaults to the value of <tt>(current-input-port)</tt>. The argument passed to <tt>PROCEDURE</tt> is a string with the contents of the line, excluding any line-terminators. When all input has been read from the port, <tt>for-each-line</tt> returns some unspecified value.</p><a name="for-each-argv-line"></a><h3>for-each-argv-line</h3><pre>[procedure] (for-each-argv-line PROCEDURE)</pre><p>Opens each file listed on the command line in order, passing one line at a time into <tt>PROCEDURE</tt>.  The filename <tt>-</tt> is interpreted as <tt>(current-input-port)</tt>.  If no arguments are given on the command line it again uses the value of <tt>(current-input-port)</tt>. During execution of <tt>PROCEDURE</tt>, the current input port will be correctly bound to the current input source.</p><p>This code will act as a simple Unix cat(1) command:</p><PRE>(for-each-argv-line print)</PRE><a name="executing-shell-commands-with-formatstring-and-error-checking"></a><h2>Executing shell commands with formatstring and error checking</h2><a name="system"></a><h3>system*</h3><pre>[procedure] (system* FORMATSTRING ARGUMENT1 ...)</pre><p>Similar to <tt>(system (sprintf FORMATSTRING ARGUMENT1 ...))</tt>, but signals an error if the invoked program should return a nonzero exit status.</p><a name="reading-a-file-s-contents"></a><h2>Reading a file's contents</h2><a name="read-all"></a><h3>read-all</h3><pre>[procedure] (read-all [FILE-OR-PORT])</pre><p>If <tt>FILE-OR-PORT</tt> is a string, then this procedure returns the contents of the file as a string. If <tt>FILE-OR-PORT</tt> is a port, all remaining input is read and returned as a string. The port is not closed. If no argument is provided, input will be read from the port that is the current value of <tt>(current-input-port)</tt>.</p><p>Previous: <a href="unit-posix.html" class="internal">Unit posix</a></p><p>Next: <a href="unit-tcp.html" class="internal">Unit tcp</a></p></body></html>

⌨️ 快捷键说明

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