picolisp

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

refH.html (8322B)


      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>H</title>
      6 <link rel="stylesheet" href="doc.css" type="text/css">
      7 </head>
      8 <body>
      9 
     10 <h1>H</h1>
     11 
     12 <dl>
     13 
     14 <dt><a name="*Hup"><code>*Hup</code></a>
     15 <dd>Global variable holding a (possibly empty) <code>prg</code> body, which will
     16 be executed when a SIGHUP signal is sent to the current process. See also
     17 <code><a href="refA.html#alarm">alarm</a></code>, <code><a
     18 href="refS.html#sigio">sigio</a></code> and <code><a
     19 href="refS.html#*Sig1">*Sig[12]</a></code>.
     20 
     21 <pre><code>
     22 : (de *Hup (msg 'SIGHUP))
     23 -> *Hup
     24 </code></pre>
     25 
     26 <dt><a name="+Hook"><code>+Hook</code></a>
     27 <dd>Prefix class for <code><a href="refR.html#+relation">+relation</a></code>s,
     28 typically <code><a href="refL.html#+Link">+Link</a></code> or <code><a
     29 href="refJ.html#+Joint">+Joint</a></code>. In essence, this maintains an local
     30 database in the referred object. See also <a href="ref.html#dbase">Database</a>.
     31 
     32 <pre><code>
     33 (rel sup (+Hook +Link) (+Sup))   # Supplier
     34 (rel nr (+Key +Number) sup)      # Item number, unique per supplier
     35 (rel dsc (+Ref +String) sup)     # Item description, indexed per supplier
     36 </code></pre>
     37 
     38 <dt><a name="+Hook2"><code>+Hook2</code></a>
     39 <dd>Prefix class for <code><a href="refI.html#+index">+index</a></code>
     40 relations. It maintains both a normal (global) index, and an object-local index
     41 in the corresponding <code><a href="refH.html#+Hook">+Hook</a></code> object.
     42 See also <a href="ref.html#dbase">Database</a>.
     43 
     44 <pre><code>
     45 (rel nm (+Hook2 +IdxFold +String) 3 shop)       # Global and shop-local index
     46 </code></pre>
     47 
     48 <dt><a name="hash"><code>(hash 'any) -> cnt</code></a>
     49 <dd>Generates a 16-bit number (1-65536) from <code>any</code>, suitable as a
     50 hash value for various purposes, like randomly balanced <code><a
     51 href="refI.html#idx">idx</a></code> structures. See also <code><a
     52 href="refC.html#cache">cache</a></code> and <code><a
     53 href="refS.html#seed">seed</a></code>.
     54 
     55 <pre><code>
     56 : (hash 0)
     57 -> 1
     58 : (hash 1)
     59 -> 55682
     60 : (hash "abc")
     61 -> 45454
     62 </code></pre>
     63 
     64 <dt><a name="hax"><code>(hax 'num) -> sym</code></a>
     65 <dt><code>(hax 'sym) -> num</code>
     66 <dd>Converts a number <code>num</code> to a string in hexadecimal/alpha
     67 notation, or a hexadecimal/alpha formatted string to a number. The digits are
     68 represented with '<code>@</code>' (zero) and the letters '<code>A</code>' -
     69 '<code>O</code>' (from "alpha" to "omega"). This format is used internally for
     70 the names of <code><a href="ref.html#external-io">external symbols</a></code> in
     71 the 64-bit version. See also <code><a href="refF.html#fmt64">fmt64</a></code>,
     72 <code><a href="refH.html#hex">hex</a></code>, <code><a
     73 href="refB.html#bin">bin</a></code> and <code><a
     74 href="refO.html#oct">oct</a></code>.
     75 
     76 <pre><code>
     77 : (hax 7)
     78 -> "G"
     79 : (hax 16)
     80 -> "A@"
     81 : (hax 255)
     82 -> "OO"
     83 : (hax "A")
     84 -> 1
     85 </code></pre>
     86 
     87 <dt><a name="hd"><code>(hd 'sym ['cnt]) -> NIL</code></a>
     88 <dd>(Debug mode only) Displays a hexadecimal dump of the file given by
     89 <code>sym</code>, limited to <code>cnt</code> lines. See also <code><a
     90 href="refP.html#proc">proc</a></code>.
     91 
     92 <pre><code>
     93 :  (hd "lib.l" 4)
     94 00000000  23 20 32 33 64 65 63 30 39 61 62 75 0A 23 20 28  # 23dec09abu.# (
     95 00000010  63 29 20 53 6F 66 74 77 61 72 65 20 4C 61 62 2E  c) Software Lab.
     96 00000020  20 41 6C 65 78 61 6E 64 65 72 20 42 75 72 67 65   Alexander Burge
     97 00000030  72 0A 0A 28 64 65 20 74 61 73 6B 20 28 4B 65 79  r..(de task (Key
     98 -> NIL
     99 </code></pre>
    100 
    101 <dt><a name="head"><code>(head 'cnt|lst 'lst) -> lst</code></a>
    102 <dd>Returns a new list made of the first <code>cnt</code> elements of
    103 <code>lst</code>. If <code>cnt</code> is negative, it is added to the length of
    104 <code>lst</code>. If the first argument is a <code>lst</code>, <code>head</code>
    105 is a predicate function returning that argument list if it is <code>equal</code>
    106 to the head of the second argument, and <code>NIL</code> otherwise. See also
    107 <code><a href="refT.html#tail">tail</a></code>.
    108 
    109 <pre><code>
    110 : (head 3 '(a b c d e f))
    111 -> (a b c)
    112 : (head 0 '(a b c d e f))
    113 -> NIL
    114 : (head 10 '(a b c d e f))
    115 -> (a b c d e f)
    116 : (head -2 '(a b c d e f))
    117 -> (a b c d)
    118 : (head '(a b c) '(a b c d e f))
    119 -> (a b c)
    120 </code></pre>
    121 
    122 <dt><a name="head/3"><code>head/3</code></a>
    123 <dd><a href="ref.html#pilog">Pilog</a> predicate that succeeds if the first
    124 (string) argument is a prefix of the string representation of the result of
    125 applying the <code><a href="refG.html#get">get</a></code> algorithm to the
    126 following arguments. Typically used as filter predicate in <code><a
    127 href="refS.html#select/3">select/3</a></code> database queries. See also
    128 <code><a href="refP.html#pre?">pre?</a></code>, <code><a
    129 href="refI.html#isa/2">isa/2</a></code>, <code><a
    130 href="refS.html#same/3">same/3</a></code>, <code><a
    131 href="refB.html#bool/3">bool/3</a></code>, <code><a
    132 href="refR.html#range/3">range/3</a></code>, <code><a
    133 href="refF.html#fold/3">fold/3</a></code>, <code><a
    134 href="refP.html#part/3">part/3</a></code> and <code><a
    135 href="refT.html#tolr/3">tolr/3</a></code>.
    136 
    137 <pre><code>
    138 : (?
    139    @Nm "Muller"
    140    @Tel "37"
    141    (select (@CuSu)
    142       ((nm +CuSu @Nm) (tel +CuSu @Tel))
    143       (tolr @Nm @CuSu nm)
    144       (head @Tel @CuSu tel) )
    145    (val @Name @CuSu nm)
    146    (val @Phone @CuSu tel) )
    147  @Nm="Muller" @Tel="37" @CuSu={2-3} @Name="Miller" @Phone="37 4773 82534"
    148 -> NIL
    149 </code></pre>
    150 
    151 <dt><a name="heap"><code>(heap 'flg) -> cnt</code></a>
    152 <dd>Returns the total size of the cell heap space in megabytes. If
    153 <code>flg</code> is non-<code>NIL</code>, the size of the currently free space
    154 is returned. See also <code><a href="refS.html#stack">stack</a></code> and
    155 <code><a href="refG.html#gc">gc</a></code>.
    156 
    157 <pre><code>
    158 : (gc 4)
    159 -> 4
    160 : (heap)
    161 -> 5
    162 : (heap T)
    163 -> 4
    164 </code></pre>
    165 
    166 <dt><a name="hear"><code>(hear 'cnt) -> cnt</code></a>
    167 <dd>Uses the file descriptor <code>cnt</code> as an asynchronous command input
    168 channel. Any executable list received via this channel will be executed in the
    169 background. As this mechanism is also used for inter-family communication (see
    170 <code><a href="refT.html#tell">tell</a></code>), <code>hear</code> is usually
    171 only called explicitly by a top level parent process.
    172 
    173 <pre><code>
    174 : (call 'mkfifo "fifo/cmd")
    175 -> T
    176 : (hear (open "fifo/cmd"))
    177 -> 3
    178 </code></pre>
    179 
    180 <dt><a name="here"><code>(here ['sym]) -> sym</code></a>
    181 <dd>Echoes the current input stream until <code>sym</code> is encountered, or
    182 until end of file. See also <code><a href="refE.html#echo">echo</a></code>.
    183 
    184 <pre><code>
    185 $ cat hello.l
    186 (html 0 "Hello" "lib.css" NIL
    187    (&lt;h2&gt; NIL "Hello")
    188    (here) )
    189 &lt;p&gt;Hello!&lt;/p&gt;
    190 &lt;p&gt;This is a test.&lt;/p&gt;
    191 
    192 $ pil @lib/http.l @lib/xhtml.l hello.l
    193 HTTP/1.0 200 OK
    194 Server: PicoLisp
    195 Date: Sun, 03 Jun 2007 11:41:27 GMT
    196 Cache-Control: max-age=0
    197 Cache-Control: no-cache
    198 Content-Type: text/html; charset=utf-8
    199 
    200 &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
    201 &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
    202 &lt;head&gt;
    203 &lt;title&gt;Hello&lt;/title&gt;
    204 &lt;link rel="stylesheet" href="http://:/lib.css" type="text/css"/&gt;
    205 &lt;/head&gt;
    206 &lt;body&gt;&lt;h2&gt;Hello&lt;/h2&gt;
    207 &lt;p&gt;Hello!&lt;/p&gt;
    208 &lt;p&gt;This is a test.&lt;/p&gt;
    209 &lt;/body&gt;
    210 &lt;/html&gt;
    211 </code></pre>
    212 
    213 <dt><a name="hex"><code>(hex 'num ['num]) -> sym</code></a>
    214 <dt><code>(hex 'sym) -> num</code>
    215 <dd>Converts a number <code>num</code> to a hexadecimal string, or a hexadecimal
    216 string <code>sym</code> to a number. In the first case, if the second argument
    217 is given, the result is separated by spaces into groups of such many digits. See
    218 also <code><a href="refB.html#bin">bin</a></code>, <code><a
    219 href="refO.html#oct">oct</a></code>, <code><a
    220 href="refF.html#fmt64">fmt64</a></code>, <code><a
    221 href="refH.html#hax">hax</a></code> and <code><a
    222 href="refF.html#format">format</a></code>.
    223 
    224 <pre><code>
    225 : (hex 273)
    226 -> "111"
    227 : (hex "111")
    228 -> 273
    229 : (hex 1234567 4)
    230 -> "12 D687"
    231 </code></pre>
    232 
    233 <dt><a name="host"><code>(host 'any) -> sym</code></a>
    234 <dd>Returns the hostname corresponding to the given IP address. See also
    235 <code><a href="refA.html#*Adr">*Adr</a></code>.
    236 
    237 <pre><code>
    238 : (host "80.190.158.9")
    239 -> "www.leo.org"
    240 </code></pre>
    241 
    242 </dl>
    243 
    244 </body>
    245 </html>