📄 refl.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>L</title><link rel="stylesheet" href="doc.css" type="text/css"></head><body><h1>L</h1><dl><dt><a name="*Led"><code>*Led</code></a><dd>A global variable holding a (possibly empty) <code>prg</code> body thatimplements a "Line editor". When non-<code>NIL</code>, it should return a singlesymbol (string) upon execution.<p><pre><code>: (de *Led "(bye)")# *Led redefined-> *Led: $ # Exit</code></pre><dt><a name="last"><code>(last 'lst) -> any</code></a><dd>Returns the last element of <code>lst</code>. See also <code><ahref="refF.html#fin">fin</a></code> and <code><ahref="refT.html#tail">tail</a></code>.<p><pre><code>: (last (1 2 3 4))-> 4: (last '((a b) c (d e f)))-> (d e f)</code></pre><dt><a name="later"><code>(later 'var . prg) -> var</code></a><dd>Executes <code>prg</code> in a <code><ahref="refP.html#pipe">pipe</a></code>'ed child process. The return value of<code>prg</code> will later be available in <code>var</code>.<p><pre><code>: (prog1 # Parallel background calculation of square numbers (mapcan '((N) (later (cons) (* N N))) (1 2 3 4)) (wait NIL (full @)) )-> (1 4 9 16)</code></pre><dt><a name="ld"><code>(ld) -> any</code></a><dd><code><a href="refL.html#load">load</a></code>s the last file edited with<code><a href="refV.html#vi">vi</a></code>.<p><pre><code>: (vi 'main)-> T: (ld)# main redefined-> go</code></pre><dt><a name="leaf"><code>(leaf 'tree) -> any</code></a><dd>Returns the first leaf (i.e. the value of the smallest key) in a databasetree. See also <code><a href="refT.html#tree">tree</a></code>, <code><ahref="refM.html#minKey">minKey</a></code>, <code><ahref="refM.html#maxKey">maxKey</a></code> and <code><ahref="refS.html#step">step</a></code>.<p><pre><code>: (leaf (tree 'nr '+Item))-> {3-1}: (db 'nr '+Item (minKey (tree 'nr '+Item)))-> {3-1}</code></pre><dt><a name="length"><code>(length 'any) -> cnt | T</code></a><dd>Returns the "length" of <code>any</code>. For numbers this is the number ofdecimal digits in the value (plus 1 for negative values), for symbols it is thenumber of characters in the name, and for lists it is the number of elements (or<code>T</code> for circular lists). See also <code><ahref="refS.html#size">size</a></code>.<p><pre><code>: (length "abc")-> 3: (length "盲bc")-> 3: (length 123)-> 3: (length (1 (2) 3))-> 3: (length (1 2 3 .))-> T</code></pre><dt><a name="let"><code>(let sym 'any . prg) -> any<br>(let (sym 'any ..) . prg) -> any</code></a><dd>Defines local variables. The value of the symbol <code>sym</code> - or thevalues of the symbols <code>sym</code> in the list of the second form - aresaved and the symbols are bound to the evaluated <code>any</code> arguments.<code>prg</code> is executed, then the symbols are restored to their originalvalues. The result of <code>prg</code> is returned. It is an error condition topass <code>NIL</code> as a <code>sym</code> argument. See also <code><ahref="refL.html#let?">let?</a></code>, <code><ahref="refB.html#bind">bind</a></code>, <code><ahref="refR.html#recur">recur</a></code>, <code><ahref="refJ.html#job">job</a></code> and <code><ahref="refU.html#use">use</a></code>.<p><pre><code>: (setq X 123 Y 456)-> 456: (let X "Hello" (println X))"Hello"-> "Hello": (let (X "Hello" Y "world") (prinl X " " Y))Hello world-> "world": X-> 123: Y-> 456</code></pre><dt><a name="let?"><code>(let? sym 'any . prg) -> any</code></a><dd>Conditional local variable binding and execution: If <code>any</code>evalutes to <code>NIL</code>, <code>NIL</code> is returned. Otherwise, the valueof the symbol <code>sym</code> is saved and <code>sym</code> is bound to theevaluated <code>any</code> argument. <code>prg</code> is executed, then<code>sym</code> is restored to its original value. The result of<code>prg</code> is returned. It is an error condition to pass <code>NIL</code>as the <code>sym</code> argument. <code>(let? sym 'any ..)</code> is equivalentto <code>(when 'any (let sym @ ..))</code>. See also <code><ahref="refL.html#let">let</a></code>, <code><ahref="refB.html#bind">bind</a></code>, <code><ahref="refJ.html#job">job</a></code> and <code><ahref="refU.html#use">use</a></code>.<p><pre><code>: (setq Lst (1 NIL 2 NIL 3))-> (1 NIL 2 NIL 3): (let? A (pop 'Lst) (println 'A A))A 1-> 1: (let? A (pop 'Lst) (println 'A A))-> NIL</code></pre><dt><a name="lieu"><code>(lieu 'any) -> sym | NIL</code></a><dd>Returns the argument <code>any</code> when it is an external symbol andcurrently manifest in heap space, otherwise <code>NIL</code>. See also <code><ahref="refE.html#ext?">ext?</a></code>.<p><pre><code>: (lieu *DB)-> {1}</code></pre><dt><a name="line"><code>(line 'flg ['cnt ..]) -> lst|sym</code></a><dd>Reads a line of characters from the current input channel. End of line isrecognized as linefeed (hex "0A"), carriage return (hex "0D"), or thecombination of both. (Note that a single carriage return may not work on networkconnections, because the character look-ahead to distinguish fromreturn+linefeed can block the connection.) If <code>flg</code> is<code>NIL</code>, a list of single-character transient symbols is returned. When<code>cnt</code> arguments are given, subsequent characters of the input lineare grouped into sublists, to allow parsing of fixed field length records. If<code>flg</code> is non-<code>NIL</code>, strings are returned instead ofsingle-character lists. <code>NIL</code> is returned upon end of file. See also<code><a href="refC.html#char">char</a></code>, <code><ahref="refT.html#till">till</a></code> and <code><ahref="refE.html#eof">eof</a></code>.<p><pre><code>: (line)abcdefghijkl-> ("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l"): (line T)abcdefghijkl-> "abcdefghijkl": (line NIL 1 2 3)abcdefghijkl-> (("a") ("b" "c") ("d" "e" "f") "g" "h" "i" "j" "k" "l"): (line T 1 2 3)abcdefghijkl-> ("a" "bc" "def" "g" "h" "i" "j" "k" "l")</code></pre><dt><a name="lines"><code>(lines 'any ..) -> cnt</code></a><dd>Returns the sum of the number of lines in the files with the names<code>any</code>. See also <code><a href="refI.html#info">info</a></code>.<p><pre><code>: (lines "x.l")-> 11</code></pre><dt><a name="link"><code>(link 'any ..) -> any</code></a><dd>Links one or several new elements <code>any</code> to the end of the list inthe current <code><a href="refM.html#make">make</a></code> environment. Thisoperation is efficient also for long lists, because a pointer to the lastelement of the list is maintained. <code>link</code> returns the last linkedargument. See also <code><a href="refY.html#yoke">yoke</a></code>, <code><ahref="refC.html#chain">chain</a></code> and <code><ahref="refM.html#made">made</a></code>.<p><pre><code>: (make (println (link 1)) (println (link 2 3)) )13-> (1 2 3)</code></pre><dt><a name="lint"><code>(lint 'sym) -> lst<br>(lint 'sym 'cls) -> lst<br>(lint '(sym . cls)) -> lst</code></a><dd>Checks the function definition or file contents (in the first form), or themethod body of sym (second and third form), for possible pitfalls. Returns alist of diagnoses, where <code>var</code> indicates an improper variable,<code>def</code> an undefined function, <code>bnd</code> an unbound variable,and <code>use</code> an unused variable. See also <code><ahref="refN.html#noLint">noLint</a></code>, <code><ahref="refL.html#lintAll">lintAll</a></code>, <code><ahref="refD.html#debug">debug</a></code> and <code><ahref="refT.html#trace">trace</a></code>.<p><pre><code>: (de foo (R S T) # 'T' is a improper parameter (let N 7 # 'N' is unused (bar X Y) ) ) # 'bar' is undefined, 'X' and 'Y' are not bound-> foo: (lint 'foo)-> ((var T) (def bar) (bnd Y X) (use N))</code></pre><dt><a name="lintAll"><code>(lintAll ['sym ..]) -> lst</code></a><dd>Applies <code><a href="refL.html#lint">lint</a></code> to <code><ahref="refA.html#all">all</a></code> internal symbols - and optionally to allfiles <code>sym</code> - and returns a list of diagnoses. See also <code><ahref="refN.html#noLint">noLint</a></code>.<p><pre><code>: (more (lintAll "file1.l" "file2.l"))...</code></pre>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -