*Hup
- Global variable holding a (possibly empty)
prg
body, which will
be executed when a SIGHUP signal is sent to the current process. See also
alarm
, sigio
and *Sig[12]
.
: (de *Hup (msg 'SIGHUP))
-> *Hup
+Hook
- Prefix class for
+relation
s,
typically +Link
or +Joint
. In essence, this maintains an local
database in the referred object. See also Database
.
(rel sup (+Hook +Link) (+Sup)) # Supplier
(rel nr (+Key +Number) sup) # Item number, unique per supplier
(rel dsc (+Ref +String) sup) # Item description, indexed per supplier
(hash 'any) -> cnt
- Generates a 16-bit number (1-65536) from
any
, suitable as a
hash value for various purposes, like randomly balanced idx
structures. See also cache
and seed
.
: (hash 0)
-> 1
: (hash 1)
-> 55682
: (hash "abc")
-> 45454
(hax 'num) -> sym
(hax 'sym) -> num
- Converts a number
num
to a string in hexadecimal/alpha
notation, or a hexadecimal/alpha formatted string to a number. The digits are
represented with '@
' (zero) and the letters 'A
' -
'O
' (from "alpha" to "omega"). This format is used internally for
the names of external symbols
in
the 64-bit version. See also fmt64
,
hex
, bin
and oct
.
: (hax 7)
-> "G"
: (hax 16)
-> "A@"
: (hax 255)
-> "OO"
: (hax "A")
-> 1
(hd 'sym ['cnt]) -> NIL
- Displays a hexadecimal dump of the file given by
sym
, limited
to cnt
lines. See also proc
.
: (hd "lib.l" 4)
00000000 23 20 32 33 64 65 63 30 39 61 62 75 0A 23 20 28 # 23dec09abu.# (
00000010 63 29 20 53 6F 66 74 77 61 72 65 20 4C 61 62 2E c) Software Lab.
00000020 20 41 6C 65 78 61 6E 64 65 72 20 42 75 72 67 65 Alexander Burge
00000030 72 0A 0A 28 64 65 20 74 61 73 6B 20 28 4B 65 79 r..(de task (Key
-> NIL
(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)
head/3
- Pilog predicate that succeeds if the first
(string) argument is a prefix of the string representation of the result of
applying the
get
algorithm to the
following arguments. Typically used as filter predicate in select/3
database queries. See also
pre?
, isa/2
, same/3
, bool/3
, range/3
, fold/3
, part/3
and tolr/3
.
: (?
@Nm "Muller"
@Tel "37"
(select (@CuSu)
((nm +CuSu @Nm) (tel +CuSu @Tel))
(tolr @Nm @CuSu nm)
(head @Tel @CuSu tel) )
(val @Name @CuSu nm)
(val @Phone @CuSu tel) )
@Nm="Muller" @Tel="37" @CuSu={2-3} @Name="Miller" @Phone="37 4773 82534"
-> NIL
(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 stack
and
gc
.
: (gc 4)
-> 4
: (heap)
-> 5
: (heap T)
-> 4
(hear 'cnt) -> cnt
- Uses the file descriptor
cnt
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>
$ pil @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 ['num]) -> sym
(hex 'sym) -> num
- Converts a number
num
to a hexadecimal string, or a hexadecimal
string sym
to a number. In the first case, if the second argument
is given, the result is separated by spaces into groups of such many digits. See
also bin
, oct
, fmt64
, hax
and format
.
: (hex 273)
-> "111"
: (hex "111")
-> 273
: (hex 1234567 4)
-> "12 D687"
(host 'any) -> sym
- Returns the hostname corresponding to the given IP address. See also
*Adr
.
: (host "80.190.158.9")
-> "www.leo.org"