# H

`*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`, `*Winch`, `*Sig[12]`, `*TStp[12]` and `*Term`.

      : (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

`+Hook2`
  Prefix class for `+index` relations. It maintains both a normal (global) index, and an object-local index in the corresponding `+Hook` object. See also Database.

      (rel nm (+Hook2 +IdxFold +String) 3 shop)       # Global and shop-local index

`(h) -> flg`
  (Debug mode only) Edits the history in memory with Vip. Returns `T` if Vip was exited with "x" and `NIL` if exited with "q". See also `history` and `vi`.

      : (h)    # Edit history
      -> T     # "x"

`(has 'any) -> lst`
  (Debug mode only) Returns a list of all internal symbols which have the value `any`. See also `who`, `can`, `what` and `dep`.

      : +
      -> 270310
      : (has 270310)
      -> (+ @)
      : meth
      -> 267259
      : (has 267259)
      -> (@ js> dec> inc> upd> ele> log> chk> val> del> rel> all> url> zap> clr> str> has>

`(hash 'any) -> cnt`
  Generates a 20-bit number (1-1048576) from `any`, suitable as a hash value for various purposes, like randomly balanced `idx` structures. See also `cache`, `enum`, `rev` and `seed`.

      : (hash 0)
      -> 1
      : (hash 1)
      -> 723519
      : (hash "abc")
      -> 557424

`(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`. See also `hex`, `bin` and `oct`.

      : (hax 7)
      -> "G"
      : (hax 16)
      -> "A@"
      : (hax 255)
      -> "OO"
      : (hax "A")
      -> 1

`(hd 'sym ['cnt]) -> NIL`
  (Debug mode only) 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` and `pre?`.

      : (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`
  (Deprecated since version 25.5.30) 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={C3} @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

`(help 'sym ['flg]) -> sym`
  (Debug mode only) Dumps the reference documentation for `sym` to the current output channel. If `flg` is non-`NIL`, the examples are dumped too. See also Function Reference and `doc`.

      : (help 'car)
      ========================================
      (car 'var) -> any

      List access: Returns the value of var if it is a symbol, or the first element if
      it is a list. See also cdr and c..r.

      -> car

      : (help 'car T)
      ========================================
      (car 'var) -> any

      List access: Returns the value of var if it is a symbol, or the first element if
      it is a list. See also cdr and c..r.

      : (car (1 2 3 4 5 6))
      -> 1

      -> car

`(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>
      <html lang="en">
      <head>
      <meta name="viewport" content="width=device-width"/>
      <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`, `hax` and `format`.

      : (hex 273)
      -> "111"
      : (hex "111")
      -> 273
      : (hex 1234567 4)
      -> "12 D687"

`(history ['lst]) -> lst`
  When called without argument, `history` returns the current `readline(3)` history. `lst` is a list of strings. Otherwise, the history is set to `lst`. See also Invocation.

      : (+ 1 2 3)
      -> 6
      : (history)
      -> ("(+ 1 2 3)" "(history)")

`(host 'any) -> sym`
  Returns the hostname corresponding to the given IP address. See also `*Adr`.

      : (host "80.190.158.9")
      -> "www.leo.org"