*Errprg body, which
will be executed during error processing. See also Error Handling, *Msg and ^.
: (de *Err (prinl "Fatal error!")) -> *Err : (/ 3 0) !? (/ 3 0) Div/0 Fatal error! ?
*Extext), 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
'((@Host @Ext)
(cons @Ext
(curry (@Host @Ext (Sock)) (Obj)
(when (or Sock (setq Sock (connect @Host 4040)))
(ext @Ext
(out Sock (pr (cons 'qsym Obj)))
(prog1
(in Sock (rd))
(unless @
(close Sock)
(off Sock) ) ) ) ) ) ) )
'("10.10.12.1" "10.10.12.2" "10.10.12.3" "10.10.12.4")
(20 40 60 80) ) )
### On the remote machines ###
(de go ()
...
(task (port 4040) # Set up background query server
(let? Sock (accept @) # Accept a connection
(unless (fork) # In child process
(in Sock
(while (rd) # Handle requests
(sync)
(tell)
(out Sock
(pr (eval @)) ) ) )
(bye) ) # Exit child process
(close Sock) ) )
...
+Entity+relation and Database.
Messages to entity objects include
zap> () # Clean up relational structures, for removal from the DB url> (Tab) # Call the GUI on that object (in optional Tab) gui> () # Generate object-specific GUI fragment upd> (X Old) # Callback method when object is created/modified/deleted has> (Var Val) # Check if value is present rel?> (Var Val) # Check if relations for value are correctly maintained put> (Var Val) # Put a new value put!> (Var Val) # Put a new value, single transaction del> (Var Val) # Delete value (also partial) del!> (Var Val) # Delete value (also partial), single transaction inc> (Var Val) # Increment numeric value inc!> (Var Val) # Increment numeric value, single transaction dec> (Var Val) # Decrement numeric value dec!> (Var Val) # Decrement numeric value, single transaction mis> (Var Val) # Return error message if value or type mismatch lose1> (Var) # Delete relational structures for a single attribute lose> (Lst) # Delete relational structures (excluding 'Lst') lose!> () # Delete relational structures, single transaction keep1> (Var) # Restore relational structures for single attribute keep> (Lst) # Restore relational structures (excluding 'Lst') keep?> (Lst) # Test for restauration (excluding 'Lst') keep!> () # Restore relational structures, single transaction set> (Val) # Set the value (type, i.e. class list) set!> (Val) # Set the value, single transaction clone> () # Object copy clone!> () # Object copy, single transaction
(e . prg) -> anyprg 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 ..]) -> symcnt 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 this case the name will be read and
returned, but not written. Returns non-NIL if the operation was
successfully completed. See also from.
: (in "x.l" (echo)) # Display file on console .. : (out "x2.l" (in "x.l" (echo))) # Copy file "x.l" to "x2.l"
(enum 'var 'cnt ['cnt ..]) -> lst(enum 'var) -> lstvar. The keys
are implicit from the enumerated cnts, and the resulting tree is
balanced (independent from the insertion order). In the first form, the
corresponding cell is returned. If it does not exist yet, it is (destructively)
inserted into the tree. If more than one cnt argument is given, the
returned cell is subsequently taken as the next tree to be processed. The second
form returns an unsorted association list of all key-value pairs in the tree.
enum can be used to emulate (possibly sparse) arrays. See also
enum?, idx and hash.
: (for (I . S) '(a b c d e f g h i j k l m n o)
(set (enum 'E I) S) )
-> o
: E
-> (a (b (d (h) l) f (j) n) c (e (i) m) g (k) o)
: (view E T)
o
g
k
c
m
e
i
a
n
f
j
b
l
d
h
-> NIL
: (enum 'E 6)
-> (f (j) n)
: (val (enum 'E 6))
-> f
: (val (enum 'E 1))
-> a
: (val (enum 'E 12))
-> l
: (enum 'E)
-> ((8 . h) (4 . d) (12 . l) (2 . b) (10 . j) (6 . f) (14 . n) (1 . a) (9 . i) (5 . e) (13 . m) (3 . c) (11 . k) (7 . g) (15 . o))
: (let A NIL # 2-dimensional array
(for I 4
(for J 4
(set (enum 'A I J) (pack I "-" J)) ) )
(for I 4
(for J 4
(prin " " (val (enum 'A I J))) )
(prinl) ) )
1-1 1-2 1-3 1-4
2-1 2-2 2-3 2-4
3-1 3-2 3-3 3-4
4-1 4-2 4-3 4-4
-> NIL
(enum? 'lst 'cnt ['cnt ..]) -> lst | NILenum tree for the
keys in the cnt arguments. Returns the corresponding cell, or
NIL if not found. The tree is not modified. See also lup.
: (enum? E 7) -> (g (k) o) : (enum? E 16) -> NIL
(env ['lst] | ['sym 'val] ..) -> lstlst, or the explicitly given sym-val
arguments. See also bind, job, trail and up.
: (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 (C . 3)) 'Y 8)) -> ((Y . 8) (C . 3) (B . 2) (A . 1) (X . 7))
(eof ['flg]) -> flgflg 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) -> flgeof.
: (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)
equal/2=, different/2 and member/2.
: (? (equal 3 4)) -> NIL : (? (equal @N 7)) @N=7 -> NIL
(err 'sym . prg) -> anysym during the execution
of prg. The current standard error stream will be saved and
restored appropriately. If the argument is NIL, the current output
stream will be used. Otherwise, sym is taken as a file name (opened
in "append" mode if the first character is "+"), where standard error is to be
written to. See also in, out and ctl.
: (err "/dev/null" # Suppress error messages (call 'ls 'noSuchFile) ) -> NIL
(errno) -> cntnative.
: (in "foo") # Produce an error !? (in "foo") "foo" -- Open error: No such file or directory ? (errno) -> 2 # Returned 'ENOENT'
(eval 'any ['cnt]) -> anyany. Note that because of the standard argument
evaluation, any is actually evaluated twice. If an offset
cnt is given, the value of @ in the cnt'th call environment
is used during the second evaluation. cnt should be greater than
zero. See also run and up.
: (eval (list '+ 1 2 3)) -> 6 : (setq X 'Y Y 7) -> 7 : X -> Y : Y -> 7 : (eval X) -> 7
(exec 'any ..)any arguments specify
the command and its arguments. Does not return to the caller; the current
process is replaced with a new process image. See also fork and call.
: (pipe (exec 'echo 123 "abc") # Equivalent to (in '(echo 123 "abc") ..)
(list (read) (read)) )
-> (123 abc)
(unless (fork)
(exec "@bin/ssl" # Start replication process
"10.11.12.13" 443
"app/!replica" "key/app" "fifo/app" "db/app/blob/" 20 ) )
(expDat 'sym) -> datdate 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. A single dot "." expands to "today", and a signed number to a date such
many days in the past or future. 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+ or 00 is removed, a leading national trunk
prefix 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"
(export ['sym]) sym|lstsym is given.
(export) expects a single symbol or a list of symbols
immediately following in the current input stream. See also pico, symbols, private, local, import and intern.
: (symbols 'myLib 'pico) -> (pico) myLib: (export) (foo bar) # Intern 'foo' and 'bar' in 'pico'
(expr 'sym) -> funsubr.
: car -> 67313448 : (expr 'car) -> (@ (pass $385260187)) : (car (1 2 3)) -> 1
(ext 'cnt . prg) -> anyprg, all external symbols processed by rd, pr,
plio,
blk 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 '({A2} ({C4} . a) ({B7} . b)))))
-> ({A2} ({C4} . a) ({B7} . b))
: (in 'a (rd))
-> ({OOOL2} ({OOON4} . a) ({OOOM7} . b))
: (in 'a (ext 5 (rd)))
-> ({A2} ({C4} . a) ({B7} . b))
(ext? 'any ['flg]) -> sym | NILany when it is an external symbol,
otherwise NIL. If flg is non-NIL, also
physical existence is checked. See also sym?, box?, str?, extern and lieu.
: (ext? *DB)
-> {1}
: (ext? 'abc)
-> NIL
: (ext? "abc")
-> NIL
: (ext? 123)
-> NIL
(extend cls) -> clscls, 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 | NILsym 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 ..]) -> anyThis, 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 ..) -> lstfun 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, for non-NIL results, to
(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)