picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

refT.html (22315B)


      1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
      2 <html lang="en">
      3 <head>
      4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      5 <title>T</title>
      6 <link rel="stylesheet" href="doc.css" type="text/css">
      7 </head>
      8 <body>
      9 
     10 <h1>T</h1>
     11 
     12 <dl>
     13 
     14 <dt><a name="*Tmp"><code>*Tmp</code></a>
     15 <dd>A global variable holding the temporary directory name created with <code><a
     16 href="refT.html#tmp">tmp</a></code>. See also <code><a
     17 href="refB.html#*Bye">*Bye</a></code>.
     18 
     19 <pre><code>
     20 : *Bye
     21 -> ((saveHistory) (and *Tmp (call 'rm "-r" *Tmp)))
     22 : (tmp "foo" 123)
     23 -> "/home/app/.pil/tmp/27140/foo123"
     24 : *Tmp
     25 -> "/home/app/.pil/tmp/27140/"
     26 </code></pre>
     27 
     28 <p><dt><a name="*Tsm"><code>*Tsm</code></a>
     29 <dd>A global variable which may hold a cons pair of two strings with escape
     30 sequences, to switch on and off an alternative transient symbol markup. If set,
     31 <code><a href="refP.html#print">print</a></code> will output these sequences to
     32 the console instead of the standard double quote markup characters. An easy way
     33 to switch on transient symbol markup is loading "@lib/tsm.l".
     34 
     35 <pre><code>
     36 : (de *Tsm "^[[4m" . "^[[24m")   # vt100 escape sequences for underline
     37 -> *Tsm
     38 : <u>Hello world</u>
     39 -> <u>Hello world</u>
     40 : (off *Tsm)
     41 -> NIL
     42 : "Hello world"                  # No underlining
     43 -> "Hello world"
     44 </code></pre>
     45 
     46 <dt><a name="+Time"><code>+Time</code></a>
     47 <dd>Class for clock time values (as calculated by <code><a
     48 href="refT.html#time">time</a></code>), a subclass of <code><a
     49 href="refN.html#+Number">+Number</a></code>. See also <a
     50 href="ref.html#dbase">Database</a>.
     51 
     52 <pre><code>
     53 (rel tim (+Time))  # Time of the day
     54 </code></pre>
     55 
     56 <dt><a name="T"><code>T</code></a>
     57 <dd>A global constant, evaluating to itself. <code>T</code> is commonly returned
     58 as the boolean value "true" (though any non-<code>NIL</code> values could be
     59 used). It represents the absolute maximum, as it is larger than any other
     60 object. As a property key, it is used to store <a
     61 href="ref.html#pilog">Pilog</a> clauses, and inside Pilog clauses it is the
     62 <i>cut</i> operator. See also <code><a href="ref.html#nilSym">NIL</a></code> and
     63 and <a href="ref.html#cmp">Comparing</a>.
     64 
     65 <pre><code>
     66 : T
     67 -> T
     68 : (= 123 123)
     69 -> T
     70 : (get 'not T)
     71 -> ((@P (1 (-> @P)) T (fail)) (@P))
     72 </code></pre>
     73 
     74 <dt><a name="This"><code>This</code></a>
     75 <dd>Holds the current object during method execution (see <a
     76 href="ref.html#oop">OO Concepts</a>), or inside the body of a <code><a
     77 href="refW.html#with">with</a></code> statement. As it is a normal symbol,
     78 however, it can be used in normal bindings anywhere. See also <code><a
     79 href="refI.html#isa">isa</a></code>, <code><a href="ref_.html#:">:</a></code>,
     80 <code><a href="ref_.html#=:">=:</a></code>, <code><a
     81 href="ref_.html#::">::</a></code> and <code><a
     82 href="refV.html#var:">var:</a></code>.
     83 
     84 <pre><code>
     85 : (with 'X (println 'This 'is This))
     86 This is X
     87 -> X
     88 : (put 'X 'a 1)
     89 -> 1
     90 : (put 'X 'b 2)
     91 -> 2
     92 : (put 'Y 'a 111)
     93 -> 111
     94 : (put 'Y 'b 222)
     95 -> 222
     96 : (mapcar '((This) (cons (: a) (: b))) '(X Y))
     97 -> ((1 . 2) (111 . 222))
     98 </code></pre>
     99 
    100 <dt><a name="t"><code>(t . prg) -> T</code></a>
    101 <dd>Executes <code>prg</code>, and returns <code>T</code>. See also <code><a
    102 href="refN.html#nil">nil</a></code>, <code><a
    103 href="refP.html#prog">prog</a></code>, <code><a
    104 href="refP.html#prog1">prog1</a></code> and <code><a
    105 href="refP.html#prog2">prog2</a></code>.
    106 
    107 <pre><code>
    108 : (t (println 'OK))
    109 OK
    110 -> T
    111 </code></pre>
    112 
    113 <dt><a name="tab"><code>(tab 'lst 'any ..) -> NIL</code></a>
    114 <dd>Print all <code>any</code> arguments in a tabular format. <code>lst</code>
    115 should be a list of numbers, specifying the field width for each argument. All
    116 items in a column will be left-aligned for negative numbers, otherwise
    117 right-aligned. See also <code><a href="refA.html#align">align</a></code>,
    118 <code><a href="refC.html#center">center</a></code> and <code><a
    119 href="refW.html#wrap">wrap</a></code>.
    120 
    121 <pre><code>
    122 : (let Fmt (-3 14 14)
    123    (tab Fmt "Key" "Rand 1" "Rand 2")
    124    (tab Fmt "---" "------" "------")
    125    (for C '(A B C D E F)
    126       (tab Fmt C (rand) (rand)) ) )
    127 Key        Rand 1        Rand 2
    128 ---        ------        ------
    129 A               0    1481765933
    130 B     -1062105905    -877267386
    131 C      -956092119     812669700
    132 D       553475508   -1702133896
    133 E      1344887256   -1417066392
    134 F      1812158119   -1999783937
    135 -> NIL
    136 </code></pre>
    137 
    138 <dt><a name="tail"><code>(tail 'cnt|lst 'lst) -> lst</code></a>
    139 <dd>Returns the last <code>cnt</code> elements of <code>lst</code>. If
    140 <code>cnt</code> is negative, it is added to the length of <code>lst</code>. If
    141 the first argument is a <code>lst</code>, <code>tail</code> is a predicate
    142 function returning that argument list if it is <code>equal</code> to the tail of
    143 the second argument, and <code>NIL</code> otherwise. <code>(tail -2 Lst)</code>
    144 is equivalent to <code>(nth Lst 3)</code>. See also <code><a
    145 href="refO.html#offset">offset</a></code>, <code><a
    146 href="refH.html#head">head</a></code>, <code><a
    147 href="refL.html#last">last</a></code> and <code><a
    148 href="refS.html#stem">stem</a></code>.
    149 
    150 <pre><code>
    151 : (tail 3 '(a b c d e f))
    152 -> (d e f)
    153 : (tail -2 '(a b c d e f))
    154 -> (c d e f)
    155 : (tail 0 '(a b c d e f))
    156 -> NIL
    157 : (tail 10 '(a b c d e f))
    158 -> (a b c d e f)
    159 : (tail '(d e f) '(a b c d e f))
    160 -> (d e f)
    161 </code></pre>
    162 
    163 <dt><a name="task"><code>(task 'num ['num] [sym 'any ..] [. prg]) -> lst</code></a>
    164 <dd>A front-end to the <code><a href="refR.html#*Run">*Run</a></code> global. If
    165 called with only a single <code>num</code> argument, the corresponding entry is
    166 removed from the value of <code>*Run</code>. Otherwise, a new entry is created.
    167 If an entry with that key already exists, an error is issued. For negative
    168 numbers, a second number must be supplied. If <code>sym</code>/<code>any</code>
    169 arguments are given, a <code><a href="refJ.html#job">job</a></code> environment
    170 is built for thie <code>*Run</code> entry. See also <code><a
    171 href="refF.html#forked">forked</a></code> and <code><a
    172 href="refT.html#timeout">timeout</a></code>.
    173 
    174 <pre><code>
    175 : (task -10000 5000 N 0 (msg (inc 'N)))            # Install task
    176 -> (-10000 5000 (job '((N . 0)) (msg (inc 'N))))   # for every 10 seconds
    177 : 1                                                # ... after 5 seconds
    178 2                                                  # ... after 10 seconds
    179 3                                                  # ... after 10 seconds
    180 (task -10000)                                      # remove again
    181 -> NIL
    182 
    183 : (task (port T 4444) (eval (udp @)))              # Receive RPC via UDP
    184 -> (3 (eval (udp @)))
    185 
    186 # Another session (on the same machine)
    187 : (udp "localhost" 4444 '(println *Pid))  # Send RPC message
    188 -> (println *Pid)
    189 </code></pre>
    190 
    191 <dt><a name="telStr"><code>(telStr 'sym) -> sym</code></a>
    192 <dd>Formats a telephone number according to the current <code><a
    193 href="refL.html#locale">locale</a></code>. If the string head matches the local
    194 country code, it is replaced with <code>0</code>, otherwise <code>+</code> is
    195 prepended. See also <code><a href="refE.html#expTel">expTel</a></code>, <code><a
    196 href="refD.html#datStr">datStr</a></code>, <code><a
    197 href="refM.html#money">money</a></code> and <code><a
    198 href="refF.html#format">format</a></code>.
    199 
    200 <pre><code>
    201 : (telStr "49 1234 5678-0")
    202 -> "+49 1234 5678-0"
    203 : (locale "DE" "de")
    204 -> NIL
    205 : (telStr "49 1234 5678-0")
    206 -> "01234 5678-0"
    207 </code></pre>
    208 
    209 <dt><a name="tell"><code>(tell ['cnt] 'sym ['any ..]) -> any</code></a>
    210 <dd>Family IPC: Send an executable list <code>(sym any ..)</code> to all family
    211 members (i.e. all children of the current process, and all other children of the
    212 parent process, see <code><a href="refF.html#fork">fork</a></code>) for
    213 automatic execution. When the <code>cnt</code> argument is given and non-zero,
    214 it should be the PID of such a process, and the list will be sent only to that
    215 process. <code>tell</code> is also used internally by <code><a
    216 href="refC.html#commit">commit</a></code> to notify about database changes. When
    217 called without arguments, no message is actually sent, and the parent process
    218 may grant <code><a href="refS.html#sync">sync</a></code> to the next waiting
    219 process. See also <code><a href="refH.html#hear">hear</a></code>.
    220 
    221 <pre><code>
    222 : (call 'ps "x")                          # Show processes
    223   PID TTY      STAT   TIME COMMAND
    224   ..
    225  1321 pts/0    S      0:00 /usr/bin/picolisp ..  # Parent process
    226  1324 pts/0    S      0:01 /usr/bin/picolisp ..  # First child
    227  1325 pts/0    S      0:01 /usr/bin/picolisp ..  # Second child
    228  1326 pts/0    R      0:00 ps x
    229 -> T
    230 : *Pid                                    # We are the second child
    231 -> 1325
    232 : (tell 'println '*Pid)                   # Ask all others to print their Pid's
    233 1324
    234 -> *Pid
    235 </code></pre>
    236 
    237 <dt><a name="test"><code>(test 'any . prg)</code></a>
    238 <dd>Executes <code>prg</code>, and issues an <code><a
    239 href="ref.html#errors">error</a></code> if the result does not <code><a
    240 href="refM.html#match">match</a></code> the <code>any</code> argument. See also
    241 <code><a href="refA.html#assert">assert</a></code>.
    242 
    243 <pre><code>
    244 : (test 12 (* 3 4))
    245 -> NIL
    246 : (test 12 (+ 3 4))
    247 ((+ 3 4))
    248 12 -- 'test' failed
    249 ?
    250 </code></pre>
    251 
    252 <dt><a name="text"><code>(text 'any1 'any ..) -> sym</code></a>
    253 <dd>Builds a new transient symbol (string) from the string representation of
    254 <code>any1</code>, by replacing all occurrences of an at-mark "<code>@</code>",
    255 followed by one of the letters "<code>1</code>" through "<code>9</code>", and
    256 "<code>A</code>" through "<code>Z</code>", with the corresponding
    257 <code>any</code> argument. In this context "<code>@A</code>" refers to the 10th
    258 argument. A literal at-mark in the text can be represented by two successive
    259 at-marks. See also <code><a href="refP.html#pack">pack</a></code> and <code><a
    260 href="refG.html#glue">glue</a></code>.
    261 
    262 <pre><code>
    263 : (text "abc @1 def @2" 'XYZ 123)
    264 -> "abc XYZ def 123"
    265 : (text "a@@bc.@1" "de")
    266 -> "a@bc.de"
    267 </code></pre>
    268 
    269 <dt><a name="throw"><code>(throw 'sym 'any)</code></a>
    270 <dd>Non-local jump into a previous <code><a
    271 href="refC.html#catch">catch</a></code> environment with the jump label
    272 <code>sym</code> (or <code>T</code> as a catch-all). Any pending <code><a
    273 href="refF.html#finally">finally</a></code> expressions are executed, local
    274 symbol bindings are restored, open files are closed and internal data structures
    275 are reset appropriately, as the environment was at the time when the
    276 corresponding <code>catch</code> was called. Then <code>any</code> is returned
    277 from that <code>catch</code>. See also <code><a
    278 href="refQ.html#quit">quit</a></code>.
    279 
    280 <pre><code>
    281 : (de foo (N)
    282    (println N)
    283    (throw 'OK) )
    284 -> foo
    285 : (let N 1  (catch 'OK (foo 7))  (println N))
    286 7
    287 1
    288 -> 1
    289 </code></pre>
    290 
    291 <dt><a name="tick"><code>(tick (cnt1 . cnt2) . prg) -> any</code></a>
    292 <dd>Executes <code>prg</code>, then (destructively) adds the number of elapsed
    293 user ticks to the <code>cnt1</code> parameter, and the number of elapsed system
    294 ticks to the <code>cnt2</code> parameter. Thus, <code>cnt1</code> and
    295 <code>cnt2</code> will finally contain the total number of user and system time
    296 ticks spent in <code>prg</code> and all functions called (this works also for
    297 recursive functions). For execution profiling, <code>tick</code> is usually
    298 inserted into words with <code>prof</code>, and removed with
    299 <code>unprof</code>. See also <code><a href="refU.html#usec">usec</a></code>.
    300 
    301 <pre><code>
    302 : (de foo ()                        # Define function with empty loop
    303    (tick (0 . 0) (do 100000000)) )
    304 -> foo
    305 : (foo)                             # Execute it
    306 -> NIL
    307 : (pp 'foo)
    308 (de foo NIL
    309    (tick (97 . 0) (do 100000000)) ) # 'tick' incremented 'cnt1' by 97
    310 -> foo
    311 </code></pre>
    312 
    313 <dt><a name="till"><code>(till 'any ['flg]) -> lst|sym</code></a>
    314 <dd>Reads from the current input channel till a character contained in
    315 <code>any</code> is found (or until end of file if <code>any</code> is
    316 <code>NIL</code>). If <code>flg</code> is <code>NIL</code>, a list of
    317 single-character transient symbols is returned. Otherwise, a single string is
    318 returned. See also <code><a href="refF.html#from">from</a></code> and <code><a
    319 href="refL.html#line">line</a></code>.
    320 
    321 <pre><code>
    322 : (till ":")
    323 abc:def
    324 -> ("a" "b" "c")
    325 : (till ":" T)
    326 abc:def
    327 -> "abc"
    328 </code></pre>
    329 
    330 <dt><a name="tim$"><code>(tim$ 'tim ['flg]) -> sym</code></a>
    331 <dd>Formats a <code><a href="refT.html#time">time</a></code> <code>tim</code>.
    332 If <code>flg</code> is <code>NIL</code>, the format is HH:MM, otherwise it is
    333 HH:MM:SS. See also <code><a href="ref_.html#$tim">$tim</a></code> and <code><a
    334 href="refD.html#dat$">dat$</a></code>.
    335 
    336 <pre><code>
    337 : (tim$ (time))
    338 -> "10:57"
    339 : (tim$ (time) T)
    340 -> "10:57:56"
    341 </code></pre>
    342 
    343 <dt><a name="time"><code>(time ['T]) -> tim</code></a>
    344 <dt><code>(time 'tim) -> (h m s)</code>
    345 <dt><code>(time 'h 'm ['s]) -> tim | NIL</code>
    346 <dt><code>(time '(h m [s])) -> tim | NIL</code>
    347 <dd>Calculates the time of day, represented as the number of seconds since
    348 midnight. When called without arguments, the current local time is returned.
    349 When called with a <code>T</code> argument, the time of the last call to
    350 <code><a href="refD.html#date">date</a></code> is returned. When called with a
    351 single number <code>tim</code>, it is taken as a time value and a list with the
    352 corresponding hour, minute and second is returned. When called with two or three
    353 numbers (or a list of two or three numbers) for the hour, minute (and optionally
    354 the second), the corresponding time value is returned (or <code>NIL</code> if
    355 they do not represent a legal time). See also <code><a
    356 href="refD.html#date">date</a></code>, <code><a
    357 href="refS.html#stamp">stamp</a></code>, <code><a
    358 href="refU.html#usec">usec</a></code>, <code><a
    359 href="refT.html#tim$">tim$</a></code> and <code><a
    360 href="ref_.html#$tim">$tim</a></code>.
    361 
    362 <pre><code>
    363 : (time)                         # Now
    364 -> 32334
    365 : (time 32334)                   # Now
    366 -> (8 58 54)
    367 : (time 25 30)                   # Illegal time
    368 -> NIL
    369 </code></pre>
    370 
    371 <dt><a name="timeout"><code>(timeout ['num])</code></a>
    372 <dd>Sets or refreshes a timeout value in the <code><a
    373 href="refR.html#*Run">*Run</a></code> global, so that the current process
    374 executes <code><a href="refB.html#bye">bye</a></code> after the given period. If
    375 called without arguments, the timeout is removed. See also <code><a
    376 href="refT.html#task">task</a></code>.
    377 
    378 <pre><code>
    379 : (timeout 3600000)           # Timeout after one hour
    380 -> (-1 3600000 (bye))
    381 : *Run                        # Look after a few seconds
    382 -> ((-1 3574516 (bye)))
    383 </code></pre>
    384 
    385 <dt><a name="tmp"><code>(tmp ['any ..]) -> sym</code></a>
    386 <dd>Returns the path name to the <code><a
    387 href="refP.html#pack">pack</a></code>ed <code>any</code> arguments in a
    388 process-local temporary directory. The directory name consists of the path to
    389 ".pil/tmp/" in the user's home directory, followed by the current process ID
    390 <code><a href="refP.html#*Pid">*Pid</a></code>. This directory is automatically
    391 created if necessary, and removed upon termination of the process (<code><a
    392 href="refB.html#bye">bye</a></code>). See also <code><a
    393 href="refP.html#pil">pil</a></code>, <code><a
    394 href="refT.html#*Tmp">*Tmp</a></code> and <code><a
    395 href="refB.html#*Bye">*Bye</a></code> .
    396 
    397 <pre><code>
    398 : *Pid
    399 -> 27140
    400 : (tmp "foo" 123)
    401 -> "/home/app/.pil/tmp/27140/foo123"
    402 : (out (tmp "foo" 123) (println 'OK))
    403 -> OK
    404 : (dir (tmp))
    405 -> ("foo123")
    406 : (in (tmp "foo" 123) (read))
    407 -> OK
    408 </code></pre>
    409 
    410 <dt><a name="tolr/3"><code>tolr/3</code></a>
    411 <dd><a href="ref.html#pilog">Pilog</a> predicate that succeeds if the first
    412 argument is either a <i>substring</i> or a <code><a
    413 href="refS.html#+Sn">+Sn</a></code> <i>soundex</i> match of the result of
    414 applying the <code><a href="refG.html#get">get</a></code> algorithm to the
    415 following arguments. Typically used as filter predicate in <code><a
    416 href="refS.html#select/3">select/3</a></code> database queries. See also
    417 <code><a href="refI.html#isa/2">isa/2</a></code>, <code><a
    418 href="refS.html#same/3">same/3</a></code>, <code><a
    419 href="refB.html#bool/3">bool/3</a></code>, <code><a
    420 href="refR.html#range/3">range/3</a></code>, <code><a
    421 href="refH.html#head/3">head/3</a></code>, <code><a
    422 href="refF.html#fold/3">fold/3</a></code> and <code><a
    423 href="refP.html#part/3">part/3</a></code>.
    424 
    425 <pre><code>
    426 : (?
    427    @Nr (1 . 5)
    428    @Nm "Sven"
    429    (select (@CuSu)
    430       ((nr +CuSu @Nr) (nm +CuSu @Nm))
    431       (range @Nr @CuSu nr)
    432       (tolr @Nm @CuSu nm) )
    433    (val @Name @CuSu nm) )
    434  @Nr=(1 . 5) @Nm="Sven" @CuSu={2-2} @Name="Seven Oaks Ltd."
    435 </code></pre>
    436 
    437 <dt><a name="touch"><code>(touch 'sym) -> sym</code></a>
    438 <dd>When <code>sym</code> is an external symbol, it is marked as "modified" so
    439 that upon a later <code><a href="refC.html#commit">commit</a></code> it will be
    440 written to the database file. An explicit call of <code>touch</code> is only
    441 necessary when the value or properties of <code>sym</code> are indirectly
    442 modified.
    443 
    444 <pre><code>
    445 : (get '{2} 'lst)
    446 -> (1 2 3 4 5)
    447 : (set (cdr (get (touch '{2}) 'lst)) 999)    # Only read-access, need 'touch'
    448 -> 999
    449 : (get '{2} 'lst)                            # Modified second list element
    450 -> (1 999 3 4 5)
    451 </code></pre>
    452 
    453 <dt><a name="trace"><code>(trace 'sym) -> sym</code></a>
    454 <dt><code>(trace 'sym 'cls) -> sym</code>
    455 <dt><code>(trace '(sym . cls)) -> sym</code>
    456 <dd>(Debug mode only) Inserts a <code><a href="ref_.html#$">$</a></code> trace
    457 function call at the beginning of the function or method body of
    458 <code>sym</code>, so that trace information will be printed before and after
    459 execution. Built-in functions (C-function pointer) are automatically converted
    460 to Lisp expressions (see <code><a href="refE.html#expr">expr</a></code>). See
    461 also <code><a href="refD.html#*Dbg">*Dbg</a></code>, <code><a
    462 href="refT.html#traceAll">traceAll</a></code> and <code><a
    463 href="refU.html#untrace">untrace</a></code>, <code><a
    464 href="refD.html#debug">debug</a></code> and <code><a
    465 href="refL.html#lint">lint</a></code>.
    466 
    467 <pre><code>
    468 : (trace '+)
    469 -> +
    470 : (+ 3 4)
    471  + : 3 4
    472  + = 7
    473 -> 7
    474 </code></pre>
    475 
    476 <dt><a name="traceAll"><code>(traceAll ['lst]) -> sym</code></a>
    477 <dd>(Debug mode only) Traces all Lisp level functions by inserting a <code><a
    478 href="ref_.html#$">$</a></code> function call at the beginning. <code>lst</code>
    479 may contain symbols which are to be excluded from that process. In addition, all
    480 symbols in the global variable <code>*NoTrace</code> are excluded. See also
    481 <code><a href="refT.html#trace">trace</a></code>, <code><a
    482 href="refU.html#untrace">untrace</a></code> and <code><a
    483 href="refD.html#*Dbg">*Dbg</a></code>.
    484 
    485 <pre><code>
    486 : (traceAll)      # Trace all Lisp level functions
    487 -> balance
    488 </code></pre>
    489 
    490 <dt><a name="trail"><code>(trail ['flg]) -> lst</code></a>
    491 <dd>(64-bit version only) Returns a stack backtrace for the current point of
    492 program execution, The list elements are either expressions (denoting function
    493 or method calls), or symbols followed by their corresponding values. If
    494 <code>flg</code> is <code>NIL</code>, the symbols and their values are omitted,
    495 and only the expressions are returned. See also <code><a
    496 href="refU.html#up">up</a></code> and <code><a
    497 href="refE.html#env">env</a></code>.
    498 
    499 <pre><code>
    500 : (de f (A B)
    501    (g (inc A) (dec B)) )
    502 -> f
    503 : (de g (X Y)
    504    (trail T) )
    505 -> g
    506 : (f 3 4)
    507 -> ((f 3 4) A 3 B 4 (g (inc A) (dec B)) X 4 Y 3)
    508 
    509 : (for (L (f 3 4)  L)  # Pretty-print trail
    510    (if (pair (car L))
    511       (println (pop 'L))
    512       (space 3)
    513       (println (pop 'L) (pop 'L)) ) )
    514 
    515    L NIL
    516 (f 3 4)
    517    A 3
    518    B 4
    519 (g (inc A) (dec B))
    520    X 4
    521    Y 3
    522 </code></pre>
    523 
    524 <dt><a name="tree"><code>(tree 'var 'cls ['hook]) -> tree</code></a>
    525 <dd>Returns a data structure specifying a database index tree. <code>var</code>
    526 and <code>cls</code> determine the relation, with an optional <code>hook</code>
    527 object. See also <code><a href="refR.html#root">root</a></code>, <code><a
    528 href="refF.html#fetch">fetch</a></code>, <code><a
    529 href="refS.html#store">store</a></code>, <code><a
    530 href="refC.html#count">count</a></code>, <code><a
    531 href="refL.html#leaf">leaf</a></code>, <code><a
    532 href="refM.html#minKey">minKey</a></code>, <code><a
    533 href="refM.html#maxKey">maxKey</a></code>, <code><a
    534 href="refI.html#init">init</a></code>, <code><a
    535 href="refS.html#step">step</a></code>, <code><a
    536 href="refS.html#scan">scan</a></code>, <code><a
    537 href="refI.html#iter">iter</a></code>, <code><a
    538 href="refP.html#prune">prune</a></code>, <code><a
    539 href="refZ.html#zapTree">zapTree</a></code> and <code><a
    540 href="refC.html#chkTree">chkTree</a></code>.
    541 
    542 <pre><code>
    543 : (tree 'nm '+Item)
    544 -> (nm . +Item)
    545 </code></pre>
    546 
    547 <dt><a name="trim"><code>(trim 'lst) -> lst</code></a>
    548 <dd>Returns a copy of <code>lst</code> with all trailing whitespace characters
    549 or <code>NIL</code> elements removed. See also <code><a
    550 href="refC.html#clip">clip</a></code>.
    551 
    552 <pre><code>
    553 : (trim (1 NIL 2 NIL NIL))
    554 -> (1 NIL 2)
    555 : (trim '(a b " " " "))
    556 -> (a b)
    557 </code></pre>
    558 
    559 <dt><a name="true/0"><code>true/0</code></a>
    560 <dd><a href="ref.html#pilog">Pilog</a> predicate that always succeeds. See also
    561 <code><a href="refF.html#fail/0">fail/0</a></code> and <code><a
    562 href="refR.html#repeat/0">repeat/0</a></code>.
    563 
    564 <pre><code>
    565 :  (? (true))
    566 -> T
    567 </code></pre>
    568 
    569 <dt><a name="try"><code>(try 'msg 'obj ['any ..]) -> any</code></a>
    570 <dd>Tries to send the message <code>msg</code> to the object <code>obj</code>,
    571 optionally with arguments <code>any</code>. If <code>obj</code> is not an
    572 object, or if the message cannot be located in <code>obj</code>, in its classes
    573 or superclasses, <code>NIL</code> is returned. See also <a
    574 href="ref.html#oop">OO Concepts</a>, <code><a
    575 href="refS.html#send">send</a></code>, <code><a
    576 href="refM.html#method">method</a></code>, <code><a
    577 href="refM.html#meth">meth</a></code>, <code><a
    578 href="refS.html#super">super</a></code> and <code><a
    579 href="refE.html#extra">extra</a></code>.
    580 
    581 <pre><code>
    582 : (try 'msg> 123)
    583 -> NIL
    584 : (try 'html> 'a)
    585 -> NIL
    586 </code></pre>
    587 
    588 <dt><a name="type"><code>(type 'any) -> lst</code></a>
    589 <dd>Return the type (list of classes) of the object <code>sym</code>. See also
    590 <a href="ref.html#oop">OO Concepts</a>, <code><a
    591 href="refI.html#isa">isa</a></code>, <code><a
    592 href="refC.html#class">class</a></code>, <code><a
    593 href="refN.html#new">new</a></code> and <code><a
    594 href="refO.html#object">object</a></code>.
    595 
    596 <pre><code>
    597 : (type '{1A;3})
    598 (+Address)
    599 : (type '+DnButton)
    600 -> (+Tiny +Rid +JS +Able +Button)
    601 </code></pre>
    602 
    603 </dl>
    604 
    605 </body>
    606 </html>