📄 refi.html
字号:
<!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>I</title><link rel="stylesheet" href="doc.css" type="text/css"></head><body><h1>I</h1><dl><dt><a name="id"><code>(id 'num 'num) -> sym<br>(id 'sym [NIL]) -> num<br>(id 'sym T) -> (num . num)</code></a><dd>Converts two numbers to an external symbol, or an external symbol to anumber or a pair of numbers.<p><pre><code>: (id 1 2)-> {1-2}: (id '{1-2})-> 2: (id '{1-2} T)-> (1 . 2)</code></pre><dt><a name="idx"><code>(idx 'var 'any 'flg) -> lst<br>(idx 'var 'any) -> lst<br>(idx 'var) -> lst</code></a><dd>Maintains an index tree in <code>var</code>, and checks for the existence of<code>any</code>. If <code>any</code> is contained in <code>var</code>, thecorresponding subtree is returned, otherwise <code>NIL</code>. In the firstform, <code>any</code> is destructively inserted into the tree if<code>flg</code> is non-<code>NIL</code>, or deleted from the tree if<code>flg</code> is <code>NIL</code>. The second form only checks for existence,but does not change the index tree. In the third form (when called with a single<code>var</code> argument) the contents of the tree are returned as a sortedlist. If all elements are inserted in sorted order, the tree degenerates into alinear list. See also <code><a href="refL.html#lup">lup</a></code>, <code><ahref="refS.html#sort">sort</a></code>, <code><ahref="refB.html#balance">balance</a></code> and <code><ahref="refM.html#member">member</a></code>.<p><pre><code>: (idx 'X 'd T) # Insert data-> NIL: (idx 'X 2 T)-> NIL: (idx 'X '(a b c) T)-> NIL: (idx 'X 17 T)-> NIL: (idx 'X 'A T)-> NIL: (idx 'X 'd T)-> (d (2 NIL 17 NIL A) (a b c)) # 'd' already existed: (idx 'X T T)-> NIL: X # View the index tree-> (d (2 NIL 17 NIL A) (a b c) NIL T): (idx 'X 'A) # Check for 'A'-> (A): (idx 'X 'B) # Check for 'B'-> NIL: (idx 'X)-> (2 17 A d (a b c) T) # Get list: (idx 'X 17 NIL) # Delete '17'-> (17 NIL A): X-> (d (2 NIL A) (a b c) NIL T) # View it again: (idx 'X)-> (2 A d (a b c) T) # '17' is deleted</code></pre><dt><a name="if"><code>(if 'any1 'any2 . prg) -> any</code></a><dd>Conditional execution: If the condition <code>any1</code> evaluates tonon-<code>NIL</code>, <code>any2</code> is evaluated and returned. Otherwise,<code>prg</code> is executed and the result returned. See also <code><ahref="refC.html#cond">cond</a></code>, <code><ahref="refW.html#when">when</a></code> and <code><ahref="refI.html#if2">if2</a></code>.<p><pre><code>: (if (> 4 3) (println 'Ok) (println 'Bad))Ok-> Ok: (if (> 3 4) (println 'Ok) (println 'Bad))Bad-> Bad</code></pre><dt><a name="if2"><code>(if2 'any1 'any2 'any3 'any4 'any5 . prg) -> any</code></a><dd>Four-way conditional execution for two conditions: If both conditions<code>any1</code> and <code>any2</code> evaluate to non-<code>NIL</code>,<code>any3</code> is evaluated and returned. Otherwise, <code>any4</code> or<code>any5</code> is evaluated and returned if <code>any1</code> or<code>any2</code> evaluate to non-<code>NIL</code>, respectively. If none of theconditions evaluate to non-<code>NIL</code>, <code>prg</code> is executed andthe result returned. See also <code><a href="refI.html#if">if</a></code> and<code><a href="refC.html#cond">cond</a></code>.<p><pre><code>: (if2 T T 'both 'first 'second 'none)-> both: (if2 T NIL 'both 'first 'second 'none)-> first: (if2 NIL T 'both 'first 'second 'none)-> second: (if2 NIL NIL 'both 'first 'second 'none)-> none</code></pre><dt><a name="ifn"><code>(ifn 'any1 'any2 . prg) -> any</code></a><dd>Conditional execution ("If not"): If the condition <code>any1</code>evaluates to <code>NIL</code>, <code>any2</code> is evaluated and returned.Otherwise, <code>prg</code> is executed and the result returned.<p><pre><code>: (ifn (= 3 4) (println 'Ok) (println 'Bad))Ok-> Ok</code></pre><dt><a name="in"><code>(in 'any . prg) -> any</code></a><dd>Opens <code>any</code> as input channel during the execution of<code>prg</code>. The current input channel will be saved and restoredappropriately. If the argument is <code>NIL</code>, standard input is used. Ifthe argument is a symbol, it is used as a file name (opened for reading<i>and</i> writing if the first character is "<code>+</code>"). If it is apositive number, it is used as the descriptor of an open file. If it is anegative number, the saved input channel such many levels above the current oneis used. Otherwise (if it is a list), it is taken as a command with arguments,and a pipe is opened for input. See also <code><ahref="refI.html#ipid">ipid</a></code>, <code><ahref="refC.html#call">call</a></code>, <code><ahref="refL.html#load">load</a></code>, <code><ahref="refO.html#out">out</a></code>, <code><ahref="refP.html#pipe">pipe</a></code> and <code><ahref="refC.html#ctl">ctl</a></code>.<p><pre><code>: (in "a" (list (read) (read) (read))) # Read three items from file "a"-> (123 (a b c) def)</code></pre><dt><a name="inc"><code>(inc 'num) -> num<br>(inc 'var ['num]) -> num</code></a><dd>The first form returns the value of <code>num</code> incremented by 1. Thesecond form increments the <code>VAL</code> of <code>var</code> by 1, or by<code>num</code>. <code>(inc 'num)</code> is equivalent to <code>(+ 'num1)</code> and <code>(inc 'var)</code> is equivalent to <code>(set 'var (+ var1))</code>.<p><pre><code>: (inc 7)-> 8: (inc -1)-> 0: (zero N)-> 0: (inc 'N)-> 1: (inc 'N 7)-> 8: N-> 8: (setq L (1 2 3 4))-> (1 2 3 4): (inc (cdr L))-> 3: L-> (1 3 3 4)</code></pre><dt><a name="index"><code>(index 'any 'lst) -> cnt | NIL</code></a><dd>Returns the <code>cnt</code> position of <code>any</code> in<code>lst</code>, or <code>NIL</code> if it is not found. See also <code><ahref="refO.html#offset">offset</a></code>.<p><pre><code>: (index 'c '(a b c d e f))-> 3: (index '(5 6) '((1 2) (3 4) (5 6) (7 8)))-> 3</code></pre><dt><a name="info"><code>(info 'any) -> (cnt|T dat . tim)</code></a><dd>Returns information about a file with the name <code>any</code>: The currentsize <code>cnt</code> in bytes, and the modification date and time (UTC). Fordirectories, <code>T</code> is returned instead of the a size. See also <code><ahref="refD.html#dir">dir</a></code>, <code><ahref="refD.html#date">date</a></code>, <code><ahref="refT.html#time">time</a></code> and <code><ahref="refL.html#lines">lines</a></code>.<p><pre><code>$ ls -l x.l-rw-r--r-- 1 abu users 208 Jun 17 08:58 x.l$ ./p dbg.l: (info "x.l")-> (208 730594 . 32315): (stamp 730594 32315)-> "2000-06-17 08:58:35"</code></pre><dt><a name="init"><code>(init 'tree ['any1] ['any2]) -> lst</code></a><dd>Initializes a structure for stepping iteratively through a database tree.<code>any1</code> and <code>any2</code> may specify a range of keys. If<code>any2</code> is greater than <code>any1</code>, the traversal will be inopposite direction. See also <code><a href="refT.html#tree">tree</a></code>,<code><a href="refS.html#step">step</a></code>, <code><ahref="refI.html#iter">iter</a></code> and <code><ahref="refS.html#scan">scan</a></code>.<p><pre><code>: (init (tree 'nr '+Item) 3 5)-> (((3 . 5) ((3 NIL . {3-3}) (4 NIL . {3-4}) (5 NIL . {3-5}) (6 NIL . {3-6}) (7 NIL . {3-8}))))</code></pre><dt><a name="insert"><code>(insert 'cnt 'lst 'any) -> lst</code></a><dd>Inserts <code>any</code> into <code>lst</code> at position <code>cnt</code>.See also <code><a href="refR.html#remove">remove</a></code>, <code><ahref="refP.html#place">place</a></code>, <code><ahref="refA.html#append">append</a></code>, <code><ahref="refD.html#delete">delete</a></code> and <code><ahref="refR.html#replace">replace</a></code>.<p><pre><code>: (insert 3 '(a b c d e) 777)-> (a b 777 c d e): (insert 1 '(a b c d e) 777)-> (777 a b c d e): (insert 9 '(a b c d e) 777)-> (a b c d e 777)</code></pre><dt><a name="intern"><code>(intern 'sym) -> sym</code></a><dd>Creates or finds an internal symbol. If a symbol with the name<code>sym</code> is already intern, it is returned. Otherwise, <code>sym</code>is interned and returned. See also <code><a href="refZ.html#zap">zap</a></code>,<code><a href="refE.html#extern">extern</a></code> and <code><ahref="ref_.html#====">====</a></code>.<p><pre><code>: (intern "abc")-> abc: (intern 'car)-> car: ((intern (pack "c" "a" "r")) (1 2 3))-> 1</code></pre><dt><a name="ipid"><code>(ipid) -> pid | NIL</code></a><dd>Returns the corresponding process ID when the current input channel isreading from a pipe, otherwise <code>NIL</code>. See also <code><ahref="refO.html#opid">opid</a></code>, <code><ahref="refI.html#in">in</a></code>, <code><ahref="refP.html#pipe">pipe</a></code> and <code><ahref="refL.html#load">load</a></code>.<p><pre><code>: (in '(ls "-l") (println (line T)) (kill (ipid)))"total 7364"-> T</code></pre><dt><a name="isa"><code>(isa 'cls|typ 'obj) -> obj | NIL</code></a><dd>Returns <code>obj</code> when it is an object that inherits from<code>cls</code> or <code>type</code>. See also <code><a href="ref.html#oop">OOConcepts</a></code>, <code><a href="refC.html#class">class</a></code>, <code><ahref="refT.html#type">type</a></code>, <code><ahref="refN.html#new">new</a></code> and <code><ahref="refO.html#object">object</a></code>.<p><pre><code>: (isa '+Address Obj)-> {1-17}: (isa '(+Male +Person) Obj)-> NIL</code></pre><dt><a name="iter"><code>(iter 'tree ['fun] ['any1] ['any2] ['flg])</code></a><dd>Iterates through a database tree by applying <code>fun</code> to all values.<code>fun</code> defaults to <code><ahref="refP.html#println">println</a></code>. <code>any1</code> and<code>any2</code> may specify a range of keys. If <code>any2</code> is greaterthan <code>any1</code>, the traversal will be in opposite direction. If<code>flg</code> is non-<code>NIL</code>, partial keys are skipped. See also<code><a href="refT.html#tree">tree</a></code>, <code><ahref="refS.html#scan">scan</a></code>, <code><ahref="refI.html#init">init</a></code> and <code><ahref="refS.html#step">step</a></code>.<p><pre><code>: (iter (tree 'nr '+Item)){3-1}{3-2}{3-3}{3-4}{3-5}{3-6}{3-8}-> {7-1}: (iter (tree 'nr '+Item) '((This) (println (: nm))))"Main Part""Spare Part""Auxiliary Construction""Enhancement Additive""Metal Fittings""Gadget Appliance""Testartikel"-> {7-1}</code></pre></dl></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -