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

📄 reft.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>T</title><link rel="stylesheet" href="doc.css" type="text/css"></head><body><h1>T</h1><dl><dt><a name="*Tmp"><code>*Tmp</code></a><dd>A global variable holding the temporary directory name created with <code><ahref="refT.html#tmp">tmp</a></code>. See also <code><ahref="refB.html#*Bye">*Bye</a></code>.<p><pre><code>: *Bye-> ((saveHistory) (and *Tmp (call 'rm "-r" *Tmp))): (tmp "foo" 123)-> "tmp/27140/foo123": *Tmp-> "tmp/27140/"</code></pre><dt><a name="T"><code>T</code></a><dd>A global constant, evaluating to itself. <code>T</code> is commonly returnedas the boolean value "true" (though any non-<code>NIL</code> values could beused). As a property key, it is used to store <a href="ref.html#pilog">Pilog</a>clauses, and inside Pilog clauses it is the <i>cut</i> operator. See also<code><a href="ref.html#nilSym">NIL</a></code>.<p><pre><code>: T-> T: (= 123 123)-> T: (get 'not T)-> ((@P (1 -> @P) T (fail)) (@P))</code></pre><dt><a name="This"><code>This</code></a><dd>Holds the current object during method execution (see <ahref="ref.html#oop">OO Concepts</a>), or inside the body of a <code><ahref="refW.html#with">with</a></code> statement. As it is a normal symbol,however, it can be used in normal bindings anywhere. See also <code><ahref="refI.html#isa">isa</a></code>, <code><a href="ref_.html#:">:</a></code>,<code><a href="ref_.html#=:">=:</a></code>, <code><ahref="ref_.html#::">::</a></code> and <code><ahref="refV.html#var:">var:</a></code>.<p><pre><code>: (with 'X (println 'This 'is This))This is X-> X: (put 'X 'a 1)-> 1: (put 'X 'b 2)-> 2: (put 'Y 'a 111)-> 111: (put 'Y 'b 222)-> 222: (mapcar '((This) (cons (: a) (: b))) '(X Y))-> ((1 . 2) (111 . 222))</code></pre><dt><a name="t"><code>(t . prg) -> T</code></a><dd>Executes <code>prg</code>, and returns <code>T</code>. See also <code><ahref="refN.html#nil">nil</a></code>, <code><ahref="refP.html#prog">prog</a></code>, <code><ahref="refP.html#prog1">prog1</a></code> and <code><ahref="refP.html#prog2">prog2</a></code>.<p><pre><code>: (t (println 'Ok))Ok-> T</code></pre><dt><a name="tab"><code>(tab 'lst 'any ..) -> NIL</code></a><dd>Print all <code>any</code> arguments in a tabular format. <code>lst</code>should be a list of numbers, specifying the field width for each argument. Allitems in a column will be left-aligned for negative numbers, otherwiseright-aligned. See also <code><a href="refA.html#align">align</a></code>,<code><a href="refC.html#center">center</a></code> and <code><ahref="refW.html#wrap">wrap</a></code>.<p><pre><code>: (let Fmt (-3 14 14)   (tab Fmt "Key" "Rand 1" "Rand 2")   (tab Fmt "---" "------" "------")   (for C '(A B C D E F)      (tab Fmt C (rand) (rand)) ) )Key        Rand 1        Rand 2---        ------        ------A               0    1481765933B     -1062105905    -877267386C      -956092119     812669700D       553475508   -1702133896E      1344887256   -1417066392F      1812158119   -1999783937-> NIL</code></pre><dt><a name="tail"><code>(tail 'cnt|lst 'lst) -> lst</code></a><dd>Returns the last <code>cnt</code> elements of <code>lst</code>. If<code>cnt</code> is negative, it is added to the length of <code>lst</code>. Ifthe first argument is a <code>lst</code>, <code>tail</code> is a predicatefunction returning that argument list if it is <code>equal</code> to the tail ofthe second argument, and <code>NIL</code> otherwise. See also <code><ahref="refH.html#head">head</a></code> and <code><ahref="refS.html#stem">stem</a></code>. <code>(tail -2 Lst)</code> is equivalentto <code>(nth Lst 3)</code>.<p><pre><code>: (tail 3 '(a b c d e f))-> (d e f): (tail -2 '(a b c d e f))-> (c d e f): (tail 0 '(a b c d e f))-> NIL: (tail 10 '(a b c d e f))-> (a b c d e f): (tail '(d e f) '(a b c d e f))-> (d e f)</code></pre><dt><a name="task"><code>(task 'num ['num] [sym 'any ..] [. prg]) -> lst</code></a><dd>A frontend to the <code><a href="refR.html#*Run">*Run</a></code> global. Ifcalled with only a single <code>num</code> argument, the corresponding entry isremoved from the value of <code>*Run</code>. Otherwise, a new entry is created.If an entry with that key already exists, an error is issued. For negativenumbers, a second number must be supplied. If <code>sym</code>/<code>any</code>arguments are given, a <code><a href="refJ.html#job">job</a></code> environmentis built for thie <code>*Run</code> entry. See also <code><ahref="refT.html#timeout">timeout</a></code>.<p><pre><code>: (task -10000 5000 N 0 (msg (inc 'N)))            # Install task-> (-10000 5000 (job '((N . 0)) (msg (inc 'N))))   # for every 10 seconds: 1                                                # ... after 5 seconds2                                                  # ... after 10 seconds3                                                  # ... after 10 seconds(task -10000)                                      # remove again-> NIL: (task (port T 4444) (eval (udp @)))              # Receive RPC via UDP-> (3 (eval (udp @)))# Another session (on the same machine): (udp "localhost" 4444 '(println *Pid))           # Send RPC message-> (println *Pid)</code></pre><dt><a name="telStr"><code>(telStr 'sym) -> sym</code></a><dd>Formats a telephone number according to the current <code><ahref="refL.html#locale">locale</a></code>. If the string head matches the localcountry code, it is replaced with <code>0</code>, otherwise <code>+</code> isprepended. See also <code><a href="refE.html#expTel">expTel</a></code>, <code><ahref="refD.html#datStr">datStr</a></code>, <code><ahref="refM.html#money">money</a></code> and <code><ahref="refF.html#format">format</a></code>.<p><pre><code>: (telStr "49 1234 5678-0")-> "+49 1234 5678-0": (locale "DE" "de")-> NIL: (telStr "49 1234 5678-0")-> "01234 5678-0"</code></pre><dt><a name="tell"><code>(tell 'sym ['any ..]) -> any</code></a><dd>Family IPC: Send an executable list <code>(sym any ..)</code> to all familymembers (i.e. all children of the current process, and all other children of theparent process, see <code><a href="refF.html#fork">fork</a></code>) forautomatic execution. <code>tell</code> can also be used by <code><ahref="refC.html#commit">commit</a></code> to notify about database changes. Seealso <code><a href="refH.html#hear">hear</a></code>, <code><ahref="refP.html#pid">pid</a></code> and <code><ahref="refR.html#rpc">rpc</a></code>.<p><pre><code>: (call 'ps "x")                            # Show processes  PID TTY      STAT   TIME COMMAND  .. 1321 pts/0    S      0:00 bin/picolisp ..  # Parent process 1324 pts/0    S      0:01 bin/picolisp ..  # First child 1325 pts/0    S      0:01 bin/picolisp ..  # Second child 1326 pts/0    R      0:00 ps x-> T: *Pid                                      # We are the second child-> 1325: (tell 'println '*Pid)                     # Ask all others to print their Pid's1324-> *Pid</code></pre><dt><a name="test"><code>(test 'any . prg)</code></a><dd>Executes <code>prg</code>, and issues an <code><ahref="ref.html#errors">error</a></code> if the result does not <code><ahref="refM.html#match">match</a></code> the <code>any</code> argument.<p><pre><code>: (test 12 (* 3 4))-> NIL: (test 12 (+ 3 4))((+ 3 4))12 -- fail?</code></pre><dt><a name="text"><code>(text 'sym 'any ..) -> sym</code></a><dd>Builds a new transient symbol (string) from <code>sym</code>, by replacingall occurrences of an at-mark "<code>@</code>", followed by one of the letters"<code>1</code>" through "<code>9</code>", and "<code>A</code>" through"<code>Z</code>", with the corresponding <code>any</code> argument. In thiscontext "<code>@A</code>" refers to the 10th argument. A literal at-mark in thetext can be represented by two successive at-marks. See also <code><ahref="refP.html#pack">pack</a></code> and <code><ahref="refG.html#glue">glue</a></code>.<p><pre><code>: (text "abc @1 def @2" 'XYZ 123)-> "abc XYZ def 123": (text "a@@bc.@1" "de")-> "a@bc.de"</code></pre><dt><a name="tim$"><code>(tim$ 'tim ['flg]) -> sym</code></a><dd>Formats a <code><a href="refT.html#time">time</a></code> <code>tim</code>.If <code>flg</code> is <code>NIL</code>, the format is HH:MM, otherwise it isHH:MM:SS. See also <code><a href="ref_.html#$tim">$tim</a></code> and <code><ahref="refD.html#dat$">dat$</a></code>.<p><pre><code>: (tim$ (time))-> "10:57": (tim$ (time) T)

⌨️ 快捷键说明

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