*Hup
- Global variable holding a (possibly empty)
prg
body, which will
be executed when a SIGHUP signal is sent to the current process. Note that this
mechanism is "unreliable", in the way that when a second signal (it may be
SIGINT, SIGUSR1/2, SIGALRM or SIGTERM) arrives before the first signal's
prg
is running, the first signal will be lost. See also alarm
, *Run
, *Sig[12]
and *Err
.
: (de *Hup (msg 'SIGHUP))
-> *Hup
(head 'cnt|lst 'lst) -> lst
- Returns a new list made of the first
cnt
elements of
lst
. If cnt
is negative, it is added to the length of
lst
. If the first argument is a lst
, head
is a predicate function returning that argument list if it is equal
to the head of the second argument, and NIL
otherwise. See also
tail
.
: (head 3 '(a b c d e f))
-> (a b c)
: (head 0 '(a b c d e f))
-> NIL
: (head 10 '(a b c d e f))
-> (a b c d e f)
: (head -2 '(a b c d e f))
-> (a b c d)
: (head '(a b c) '(a b c d e f))
-> (a b c)
(heap 'flg) -> cnt
- Returns the total size of the cell heap space in megabytes. If
flg
is non-NIL
, the size of the currently free space
is returned. See also gc
.
: (gc 4)
-> 4
: (heap)
-> 5
: (heap T)
-> 4
(hear 'num) -> num
- Uses the file descriptor
num
as an asynchronous command input
channel. Any executable list received via this channel will be executed in the
background. As this mechanism is also used for inter-family communication (see
tell
), hear
is usually
only called explicitly by a top level parent process.
: (call 'mkfifo "fifo/cmd")
-> T
: (hear (open "fifo/cmd"))
-> 3
(here ['sym]) -> sym
- Echoes the current input stream until
sym
is encountered, or
until end of file. See also echo
.
$ cat hello.l
(html 0 "Hello" "lib.css" NIL
(<h2> NIL "Hello")
(here) )
<p>Hello!</p>
<p>This is a test.</p>
$ ./p lib/http.l lib/xhtml.l hello.l
HTTP/1.0 200 OK
Server: PicoLisp
Date: Sun, 03 Jun 2007 11:41:27 GMT
Cache-Control: max-age=0
Cache-Control: no-cache
Content-Type: text/html; charset=utf-8
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Hello</title>
<link rel="stylesheet" href="http://:/lib.css" type="text/css"/>
</head>
<body><h2>Hello</h2>
<p>Hello!</p>
<p>This is a test.</p>
</body>
</html>
(hex 'num) -> sym
(hex 'sym) -> num
- Converts a number
num
to a hexadecimal string, or a hexadecimal
string sym
to a number. See also oct
and format
.
: (hex 273)
-> "111"
: (hex "111")
-> 273
(host 'any) -> sym
- Returns the hostname corresponding to the given IP address. See also
*Adr
.
: (host "80.190.158.9")
-> "www.leo.org"