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

📄 refc.html

📁 A very small LISP implementation with several packages and demo programs.
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>C</title><link rel="stylesheet" href="doc.css" type="text/css"></head><body><h1>C</h1><dl><dt><a name="*Class"><code>*Class</code></a><dd>A global variable holding the current class. See also <code><ahref="ref.html#oop">OO Concepts</a></code>, <code><ahref="refC.html#class">class</a></code>, <code><ahref="refE.html#extend">extend</a></code>, <code><ahref="refD.html#dm">dm</a></code> and <code><ahref="refV.html#var">var</a></code> and <code><ahref="refR.html#rel">rel</a></code>.<p><pre><code>: (class +Test)-> +Test: *Class-> +Test</code></pre><dt><a name="caaar"><code>(caaar 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(car (car (car 'lst)))</code>.<p><pre><code>: (caaar '(((1 2) 3) 4))-> 1</code></pre><dt><a name="caadr"><code>(caadr 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(car (car (cdr 'lst)))</code>.<p><pre><code>: (caadr '(1 (2 3)))-> 2</code></pre><dt><a name="caar"><code>(caar 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(car (car 'lst))</code>.<p><pre><code>: (caar '((1 2) (3 4)))-> 1</code></pre><dt><a name="cache"><code>(cache 'var 'sym . prg) -> any</code></a><dd>Speeds up some calculations, by holding previously calculated results in an<code><a href="refI.html#idx">idx</a></code> tree structure. <code>sym</code>must be a transient symbol representing a unique key for the argument(s) to thecalculation.<p><pre><code>: (de fibonacci (N)   (cache '*Fibonacci (format N)      (if (< N 2)         1         (+            (fibonacci (dec N))            (fibonacci (- N 2)) ) ) ) )-> fibonacci: (fibonacci 22)-> 28657: (fibonacci 10000)-> 5443837311356528133873426099375038013538 ...  # (2090 digits)</code></pre><dt><a name="cadar"><code>(cadar 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(car (cdr (car 'lst)))</code>.<p><pre><code>: (cadar '((1 2 3)))-> 2</code></pre><dt><a name="cadddr"><code>(cadddr 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(car (cdr (cdr (cdr'lst))))</code>, or the fourth element of <code>lst</code>.<p><pre><code>: (cadddr (1 2 3 4 5 6))-> 4</code></pre><dt><a name="caddr"><code>(caddr 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(car (cdr (cdr 'lst)))</code>, orthe third element of <code>lst</code>.<p><pre><code>: (caddr (1 2 3 4 5 6))-> 3</code></pre><dt><a name="cadr"><code>(cadr 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(car (cdr 'lst))</code>, or thesecond element of <code>lst</code>.<p><pre><code>: (cadr (1 2 3 4 5 6))-> 2</code></pre><dt><a name="call"><code>(call 'any ..) -> flg</code></a><dd>Calls an external system command. The <code>any</code> arguments specify thecommand and its arguments. Returns <code>T</code> if the command was executedsuccessfully.<p><pre><code>: (when (call 'test "-r" "file.l")  # Test if file exists and is readable   (load "file.l")                  # Load it   (call 'rm "file.l") )            # Remove it</code></pre><dt><a name="car"><code>(car 'lst) -> any</code></a><dd>List access: Returns the first element of <code>lst</code>.<p><pre><code>: (car (1 2 3 4 5 6))-> 1</code></pre><dt><a name="case"><code>(case 'any (any1 . prg1) (any2 . prg2) ..) -> any</code></a><dd>Multi-way branch: <code>any</code> is evaluated and compared to the<code>CAR</code> elements <code>anyN</code> of each clause. If one of them is alist, <code>any</code> is in turn compared to all elements of that list.<code>T</code> is a catch-all for any value. If a comparison succeeds,<code>prgN</code> is executed, and the result returned. Otherwise<code>NIL</code> is returned.<p><pre><code>: (case (char 66) ("A" (+ 1 2 3)) (("B" "C") "Bambi") ("D" (* 1 2 3)))-> "Bambi"</code></pre><dt><a name="catch"><code>(catch 'sym . prg) -> any</code></a><dd>Sets up the environment for a non-local jump with <code><ahref="refT.html#throw">throw</a></code>. <code>sym</code> is used by<code>throw</code> as a jump label (with <code>T</code> being a catch-all forany label). If <code>throw</code> is called during the execution of<code>prg</code>, the value thrown is returned immediately. Otherwise, theresult of <code>prg</code> is returned. See also <code><ahref="refF.html#finally">finally</a></code>.<p><pre><code>: (catch 'Ok (println 1) (throw 'Ok 999) (println 2))1-> 999</code></pre><dt><a name="cd"><code>(cd 'any) -> sym</code></a><dd>Changes the current directory to <code>any</code>. The old directory isreturned on success, otherwise <code>NIL</code>. See also <code><ahref="refD.html#dir">dir</a></code> and <code><ahref="refP.html#pwd">pwd</a></code>.<p><pre><code>: (when (cd "lib")   (println (sum lines (dir)))   (cd @) )10955</code></pre><dt><a name="cdaar"><code>(cdaar 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(cdr (car (car 'lst)))</code>.<p><pre><code>: (cdaar '(((1 2 3))))-> (2 3)</code></pre><dt><a name="cdadr"><code>(cdadr 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(cdr (car (cdr 'lst)))</code>.<p><pre><code>: (cdadr '((1 2) (3 4)))-> (4)</code></pre><dt><a name="cdar"><code>(cdar 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(cdr (car 'lst))</code>.<p><pre><code>: (cdar '((1 2) (3 4)))-> (2)</code></pre><dt><a name="cddar"><code>(cddar 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(cdr (cdr (car 'lst)))</code>.<p><pre><code>: (cddar '((1 2 3 4)))-> (3 4)</code></pre><dt><a name="cddddr"><code>(cddddr 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(cdr (cdr (cdr (cdr'lst))))</code>. Returns all but the first four elements of <code>lst</code>.<p><pre><code>: (cddddr (1 2 3 4 5 6))-> (5 6)</code></pre><dt><a name="cdddr"><code>(cdddr 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(cdr (cdr (cdr 'lst)))</code>.Returns all but the first three elements of <code>lst</code>.<p><pre><code>: (cdddr (1 2 3 4 5 6))-> (4 5 6)</code></pre><dt><a name="cddr"><code>(cddr 'lst) -> any</code></a><dd>List access shortcut: Equivalent to <code>(cdr (cdr 'lst))</code>. Returnsall but the first two elements of <code>lst</code>.<p><pre><code>: (cddr (1 2 3 4 5 6))-> (3 4 5 6)</code></pre><dt><a name="cdr"><code>(cdr 'lst) -> any</code></a><dd>List access: Returns all but the first element of <code>lst</code>.<p><pre><code>: (cdr (1 2 3 4 5 6))-> (2 3 4 5 6)</code></pre><dt><a name="center"><code>(center 'cnt|lst 'any ..) -> sym<br></code></a><dd>Returns a transient symbol with all <code>any</code> arguments <code><ahref="refP.html#pack">pack</a></code>ed in a centered format. Trailing blanksare omitted. See also <code><a href="refA.html#align">align</a></code>, <code><ahref="refT.html#tab">tab</a></code> and <code><ahref="refW.html#wrap">wrap</a></code>.<p><pre><code>: (center 4 12)-> " 12": (center 4 "a")-> " a": (center 7 "a")-> "   a": (center (3 3 3) "a" "b" "c")-> " a  b  c"</code></pre><dt><a name="chain"><code>(chain 'lst ..) -> lst</code></a><dd>Concatenates (destructively) one or several new list elements<code>lst</code> to the end of the list in the current <code><ahref="refM.html#make">make</a></code> environment. This operation is efficientalso for long lists, because a pointer to the last element of the list ismaintained. <code>chain</code> returns the last linked argument. See also<code><a href="refL.html#link">link</a></code>, <code><ahref="refY.html#yoke">yoke</a></code> and <code><ahref="refM.html#made">made</a></code>.<p><pre><code>: (make (chain (list 1 2 3) NIL (cons 4)) (chain (list 5 6)))-> (1 2 3 4 5 6)</code></pre><dt><a name="char"><code>(char) -> sym<br>(char 'cnt) -> sym<br>(char T) -> sym<br>(char 'sym) -> cnt</code></a><dd>When called without arguments, the next character from the current inputstream is returned as a single-character transient symbol, or <code>NIL</code>upon end of file. When called with a number <code>cnt</code>, a character withthe corresponding unicode value is returned. As a special case, <code>T</code>is accepted to produce a byte value greater than any first byte in a unicodecharacter (used as a top value in comparisons). Otherwise, when called with asymbol <code>sym</code>, the numeric unicode value of the first character of thename of that symbol is returned. See also <code><ahref="refP.html#peek">peek</a></code>, <code><ahref="refS.html#skip">skip</a></code>, <code><ahref="refK.html#key">key</a></code>, <code><ahref="refL.html#line">line</a></code>, <code><ahref="refT.html#till">till</a></code> and <code><ahref="refE.html#eof">eof</a></code>.<p><pre><code>: (char)                   # Read character from consoleA                          # (typed 'A' and a space/return)-> "A": (char 100)               # Convert unicode to symbol-> "d": (char T)                 # Special case, catch all-> # (not printable): (char "d")               # Convert symbol to unicode-> 100</code></pre><dt><a name="chdir"><code>(chdir 'any . prg) -> any</code></a><dd>Changes the current directory to <code>any</code> with <code><ahref="refC.html#cd">cd</a></code> during the execution of <code>prg</code>. Thenthe previous directory will be restored and the result of <code>prg</code>returned. See also <code><a href="refD.html#dir">dir</a></code> and <code><ahref="refP.html#pwd">pwd</a></code>.<p><pre><code>: (pwd)-> "/usr/abu/pico": (chdir "src" (pwd))-> "/usr/abu/pico/src": (pwd)-> "/usr/abu/pico"</code></pre><dt><a name="chkTree"><code>(chkTree 'sym ['fun]) -> num</code></a><dd>Checks a database tree node (and recursively all sub-nodes) for consistency.Returns the total number of nodes checked. Optionally, <code>fun</code> iscalled with the key and value of each node, and should return <code>NIL</code>for failure. See also <code><a href="refT.html#tree">tree</a></code> and<code><a href="refR.html#root">root</a></code>.<p><pre><code>: (show *DB '+Item){C} NIL   sup (7 . {7-3})   nr (7 . {7-1})    # 7 nodes in the 'nr' tree, base node is {7-1}   pr (7 . {7-4})   nm (77 . {7-6})-> {C}: (chkTree '{7-1})   # Check that node-> 7</code></pre><dt><a name="chop"><code>(chop 'any) -> lst</code></a><dd>Returns <code>any</code> as a list of single-character strings. If

⌨️ 快捷键说明

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