(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 number of free cells currently available (if
flg
is NIL
), or the total number of cells in
the system (if flg
is non-NIL
).
: (heap)
-> 126999
: (heap T)
-> 262144
(hear 'num|sym) -> any
- Uses the file descriptor
num
, or opens the file
sym
, 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.
: (hear "fifo/cmd")
-> "fifo/cmd"
(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 "217.160.106.89")
-> "software-lab.biz"