*Err
- A global variable holding a (possibly empty)
prg
body, which
will be executed during error processing. See also Error Handling
, *Msg
and ^
.
: (de *Err (prinl "Fatal error!"))
-> ((prinl "Fatal error!"))
: (/ 3 0)
!? (/ 3 0)
Div/0
Fatal error!
$
*Ext
- A global variable holding a sorted list of cons pairs. The CAR of each pair
specifies an external symbol offset (suitable for
ext
), and the CDR should be a function taking a
single external symbol as an argument. This function should return a list, with
the value for that symbol in its CAR, and the property list (in the format used
by getl
and putl
) in its CDR. The symbol will be set to
this value and property list upon access. Typically this function will access
the corresponding symbol in a remote database process. See also qsym
and external symbols
.
### On the local machine ###
: (setq *Ext # Define extension functions
(mapcar
'((V)
(let (@Ext (car V) @Host (cddr V) @Port (cadr V) Sock)
(cons @Ext
(curry (@Ext @Host @Port Sock) (Obj)
(when (or Sock (setq Sock (connect @Host @Port)))
(ext @Ext
(out Sock (pr (cons 'qsym Obj)))
(prog1 (in Sock (rd))
(unless @
(close Sock)
(off Sock) ) ) ) ) ) ) ) )
(quote
(20 4000 . "10.10.12.1")
(40 4000 . "10.10.12.2")
(60 4000 . "10.10.12.3")
(80 4000 . "10.10.12.4") ) ) )
### On the remote machines ###
(de go ()
...
(task (port 4000) # Set up the object server in the background
(when (setq Sock (accept @))
(unless (fork) # Child process
(task P)
(close P)
(in Sock
(while (rd)
(sync)
(out Sock (pr (eval @))) ) )
(bye) )
(close Sock) ) )
...
(e . prg) -> any
- Used in a breakpoint. Evaluates
prg
in the execution
environment, or the currently executed expression if prg
is not
given. See also debug
, !
, ^
and
*Dbg
.
: (! + 3 4)
(+ 3 4)
! (e)
-> 7
(echo ['cnt ['cnt]] | ['sym ..]) -> sym
- Reads the current input channel, and writes to the current output channel.
If
cnt
is given, only that many bytes are actually echoed. In case
of two cnt
arguments, the first one specifies the number of bytes
to skip in the input stream. Otherwise, if one or more sym
arguments are given, the echo process stops as soon as one of the symbol's names
is encountered in the input stream (in that case, the name will be read (and
that symbol returned), but not written). Returns non-NIL
if the
operation was successfully completed.
: (in "x.l" (echo)) # Display file on console
..
: (out "x2.l" (in "x.l" (echo))) # Copy file "x.l" to "x2.l"
(env ['lst] | ['sym 'val] ..) -> lst
- Return a list of symbol-value pairs of all dynamically bound symbols if
called without arguments, or of the symbols in
lst
, or the
explicitly given sym
-val
arguments. See also bind
and job
.
: (env)
-> NIL
: (let (A 1 B 2) (env))
-> ((A . 1) (B . 2))
: (let (A 1 B 2) (env '(A B)))
-> ((B . 2) (A . 1))
: (let (A 1 B 2) (env 'X 7 '(A B) 'Y 8))
-> ((Y . 8) (B . 2) (A . 1) (X . 7))
(eof ['flg]) -> flg
- Returns the end-of-file status of the current input channel. If
flg
is non-NIL
, the channel's status is forced to
end-of-file, so that the next call to eof
will return
T
, and calls to char
,
peek
, line
, from
, till
, read
or skip
will return NIL
. Note that
eof
cannot be used with the binary rd
function. See also eol
.
: (in "file" (until (eof) (println (line T))))
...
(eol) -> flg
- Returns the end-of-line status of the current input channel.
See also
eof
.
: (make (until (prog (link (read)) (eol)))) # Read line into a list
a b c (d e f) 123
-> (a b c (d e f) 123)
(eval 'any ['cnt ['lst]]) -> any
- Evaluates
any
. Note that because of the standard argument
evaluation, any
is actually evaluated twice. If a binding
environment offset cnt
is given, the second evaluation takes place
in the corresponding environment, and an optional lst
of excluded
symbols can be supplied. See also run
and up
.
: (eval (list '+ 1 2 3))
-> 6
: (setq X 'Y Y 7)
-> 7
: X
-> Y
: Y
-> 7
: (eval X)
-> 7
(expDat 'sym) -> dat
- Expands a
date
string according to
the current locale
(delimiter, and
order of year, month and day). Accepts abbreviated input, without delimiter and
with only the day, or the day and month, or the day, month and year of current
century. See also datStr
, day
, expTel
.
: (date)
-> 733133
: (date (date))
-> (2007 5 31)
: (expDat "31")
-> 733133
: (expDat "315")
-> 733133
: (expDat "3105")
-> 733133
: (expDat "31057")
-> 733133
: (expDat "310507")
-> 733133
: (expDat "2007-05-31")
-> 733133
: (expDat "7-5-31")
-> 733133
: (locale "DE" "de")
-> NIL
: (expDat "31.5")
-> 733133
: (expDat "31.5.7")
-> 733133
(expTel 'sym) -> sym
- Expands a telephone number string. Multiple spaces or hyphens are coalesced.
A leading
+
or 00
is removed, a leading 0
is replaced with the current country code. Otherwise, NIL
is
returned. See also telStr
, expDat
and locale
.
: (expTel "+49 1234 5678-0")
-> "49 1234 5678-0"
: (expTel "0049 1234 5678-0")
-> "49 1234 5678-0"
: (expTel "01234 5678-0")
-> NIL
: (locale "DE" "de")
-> NIL
: (expTel "01234 5678-0")
-> "49 1234 5678-0"
(expr 'sym) -> fun
- Converts a C-function ("subr") to a Lisp-function. Useful only for normal
functions (i.e. functions that evaluate all arguments). See also
subr
.
: car
-> 67313448
: (expr 'car)
-> (@ (pass $385260187))
: (car (1 2 3))
-> 1
(ext 'cnt . prg) -> any
- During the execution of
prg
, all external symbols
processed by rd
, pr
,
rpc
or udp
are modified by an offset cnt
suitable for mapping via the *Ext
mechanism. All external symbol's file numbers are decremented by
cnt
during output, and incremented by cnt
during
input.
: (out 'a (ext 5 (pr '({6-2} ({8-9} . a) ({7-7} . b)))))
-> ({6-2} ({8-9} . a) ({7-7} . b))
: (in 'a (rd))
-> ({2} ({3-9} . a) ({2-7} . b))
: (in 'a (ext 5 (rd)))
-> ({6-2} ({8-9} . a) ({7-7} . b))
(ext? 'any) -> sym | NIL
- Returns the argument
any
when it is an existing external
symbol, otherwise NIL
. See also sym?
, box?
, str?
, extern
and lieu
.
: (ext? *DB)
-> {1}
: (ext? 'abc)
-> NIL
: (ext? "abc")
-> NIL
: (ext? 123)
-> NIL
(extend cls) -> cls
- Extends the class
cls
, by storing it in the global variable
*Class
. As a consequence, all
following method, relation and class variable definitions are applied to that
class. See also OO Concepts
, class
, dm
, var
,
rel
, type
and isa
.
(extern 'sym) -> sym | NIL
- Creates or finds an external symbol. If a symbol with the name
sym
is already extern, it is returned. Otherwise, a new external
symbol is returned. NIL
is returned if sym
does not
exist in the database. See also intern
and ext?
.
: (extern "A1b")
-> {A1b}
: (extern "{A1b}")
-> {A1b}
(extra ['any ..]) -> any
- Can only be used inside methods. Sends the current message to the current
object
This
, this time starting the search for a method at the
remaining branches of the inheritance tree of the class where the current method
was found. See also OO Concepts
,
super
, method
, meth
, send
and try
.
(dm key> (C) # 'key>' method of the '+Uppc' class
(uppc (extra C)) ) # Convert 'key>' of extra classes to upper case
(extract 'fun 'lst ..) -> lst
- Applies
fun
to each element of lst
. When
additional lst
arguments are given, their elements are also passed
to fun
. Returns a list of all non-NIL
values returned
by fun
. (extract 'fun 'lst)
is equivalent to
(mapcar 'fun (filter 'fun 'lst))
or (mapcan '((X) (and (fun X)
(cons @))) 'lst)
. See also filter
, find
, pick
and mapcan
.
: (setq A NIL B 1 C NIL D 2 E NIL F 3)
-> 3
: (filter val '(A B C D E F))
-> (B D F)
: (extract val '(A B C D E F))
-> (1 2 3)