*Scl
- A global variable holding the current fixed-point input scale. See also Numbers and
scl.
: (str "123.45") # Default value of '*Scl' is 0
-> (123)
: (setq *Scl 3)
-> 3
: (str "123.45")
-> (123450)
*Sig1
*Sig2
- Global variables holding (possibly empty)
prg bodies, which
will be executed when a SIGUSR1 signal (or a SIGUSR2 signal, respectively) is
sent to the current process. Note that this mechanism is "unreliable", in the
way that when a second signal (it may be SIGHUP, SIGINT, another SIGUSR1/2,
SIGALRM or SIGTERM) arrives before the first signal's prg is
running, the first signal will be lost. See also alarm, *Run, *Hup and *Err.
: (de *Sig1 (msg 'SIGUSR1))
-> *Sig1
*Solo
- A global variable indicating exclusive database access. Its value is
0 initially, set to T (or NIL) during
cooperative database locks when lock
is successfully called with a NIL (or non-NIL)
argument. See also *Zap.
: *Solo
-> 0
: (lock *DB)
-> NIL
: *Solo
-> NIL
: (rollback)
-> T
: *Solo
-> 0
: (lock)
-> NIL
: *Solo
-> T
: (rollback)
-> T
: *Solo
-> T
(scan 'tree ['fun] ['any1] ['any2] ['flg])
- Scans through a database tree by applying
fun to all key-value
pairs. fun should be a function accepting two arguments for key and
value. It defaults to println.
any1 and any2 may specify a range of keys. If
any2 is greater than any1, the traversal will be in
opposite direction. If flg is non-NIL, partial keys
are skipped. See also tree, iter, init and step.
: (scan (tree 'nm '+Item))
("ASLRSNSTRSTN" {3-3} . T) {3-3}
("Additive" {3-4}) {3-4}
("Appliance" {3-6}) {3-6}
("Auxiliary Construction" . {3-3}) {3-3}
("Construction" {3-3}) {3-3}
("ENNSNNTTTF" {3-4} . T) {3-4}
("Enhancement Additive" . {3-4}) {3-4}
("Fittings" {3-5}) {3-5}
("GTSTFLNS" {3-6} . T) {3-6}
("Gadget Appliance" . {3-6}) {3-6}
...
: (scan (tree 'nm '+Item) println NIL T T) # 'flg' is non-NIL
("Auxiliary Construction" . {3-3}) {3-3}
("Enhancement Additive" . {3-4}) {3-4}
("Gadget Appliance" . {3-6}) {3-6}
("Main Part" . {3-1}) {3-1}
("Metal Fittings" . {3-5}) {3-5}
("Spare Part" . {3-2}) {3-2}
("Testartikel" . {3-8}) {3-8}
-> {7-6}
(scl 'num . prg) -> any
- Binds
*Scl dynamically to
num during the execution of prg. See also Numbers.
: (scl 0 (str "123.45"))
-> (123)
: (scl 1 (read))
123.45
-> 1235
: (scl 3 (str "123.45"))
-> (123450)
(sect 'lst 'lst) -> lst
- Returns the intersection of the
lst arguments. See also
diff.
: (sect (1 2 3 4) (3 4 5 6))
-> (3 4)
: (sect (1 2 3) (4 5 6))
-> NIL
(seed 'any) -> cnt
- Initializes the random generator's seed, and returns a pseudo random number
in the range -2147483648 .. +2147483647. See also
rand.
: (seed "init string")
-> 2015582081
: (rand)
-> -706917003
: (rand)
-> 1224196082
: (seed (time))
-> 128285383
(seek 'fun 'lst ..) -> lst
- Applies
fun to lst and all successive CDRs, until
non-NIL is returned. Returns the tail of lst starting
with that element, or NIL if fun did not return
non-NIL for any element of lst. When additional
lst arguments are given, they are passed to fun in the
same way. See also find, pick.
: (seek '((X) (> (car X) 9)) (1 5 8 12 19 22))
-> (12 19 22)
(send 'msg 'obj ['any ..]) -> any
- Sends the message
msg to the object obj,
optionally with arguments any. If the message cannot be located in
obj, its classes and superclasses, an error "Bad
message" is issued. See also OO
Concepts, try, method, meth, super and extra.
: (send 'stop> Dlg) # Equivalent to (stop> Dlg)
-> NIL
(seq 'cnt|sym1 ['sym2 ['num]]) -> sym | num | NIL
- Sequential single step: Returns the first external symbol in the
cnt'th database file, or the next external symbol following
sym1 in the database, or NIL when the end of the
database is reached. When sym2 is given, the database is extended
up to (including the creation of) sym2. If num is
given, it should be the return value of a previous call to seq, and
is used as an internal free list link. See also free.
: (pool "db")
-> T
: (seq *DB)
-> {2}
: (seq @)
-> {3}
(set 'var 'any ..) -> any
- Stores new values
any in the var arguments.
: (set 'L '(a b c) (cdr L) '999)
-> 999
: L
-> (a 999 c)
(setq var 'any ..) -> any
- Stores new values
any in the var arguments.
: (setq A 123 B (list A A)) # Set 'A' to 123, then 'B' to (123 123)
-> (123 123)
(show 'any ['sym|cnt]) -> any
- Shows the name, value and property list of a symbol found by applying the
get algorithm to any and
the following arguments. See also view.
: (setq A 123456)
-> 123456
: (put 'A 'x 1)
-> 1
: (put 'A 'lst (9 8 7))
-> (9 8 7)
: (put 'A 'flg T)
-> T
: (show 'A)
A 123456
flg
lst (9 8 7)
x 1
-> A
: (show 'A 'lst 2)
-> 8
(size 'any) -> cnt
- Returns the "size" of
any. For numbers this is the number of
bytes needed for the value, for external symbols it is the number of bytes it
would occupy in the database, for other symbols it is the number of bytes
occupied in the UTF-8 representation of the name, and for lists it is the total
number of cells in this list and all its sublists. See also length.
: (size "abc")
-> 3
: (size "äbc")
-> 4
: (size 123)
-> 1
: (size (1 (2) 3))
-> 4
: (size (1 2 3 .))
-> 3
(skip ['sym]) -> sym
- Skips all white space (and comments if
sym is given) in the
input stream. Returns the next available character, or NIL upon end
of file. See also peek and eof.
$ cat a
# Comment
abcd
$ ./p dbg.l
: (in "a" (skip "#"))
-> "a"
(sort 'lst) -> lst
- Sorts
lst by destructively exchanging its elements. See also Comparing, group and uniq.
: (sort '(a 3 1 (1 2 3) d b 4 T NIL (a b c) (x y z) c 2))
-> (NIL 1 2 3 4 a b c d (1 2 3) (a b c) (x y z) T)
(space ['cnt]) -> cnt
- Prints
cnt spaces, or a single space when cnt is
not given.
: (space)
-> 1
: (space 1)
-> 1
: (space 2)
-> 2
(sp? 'any) -> flg
- Returns
T when the argument any is
NIL, or if it is a string (symbol) that consists only of whitespace
characters.
: (sp? " ")
-> T
: (sp? "ABC")
-> NIL
: (sp? 123)
-> NIL
(split 'lst 'any ..) -> lst
- Splits
lst at all places containing an element any
and returns the resulting list of sublists. See also stem.
: (split (1 a 2 b 3 c 4 d 5 e 6) 'e 3 'a)
-> ((1) (2 b) (c 4 d 5) (6))
: (mapcar pack (split (chop "The quick brown fox") " "))
-> ("The" "quick" "brown" "fox")
(sqrt 'num) -> num
- Returns the square root of the
num argument.
: (sqrt 64)
-> 8
: (sqrt 1000)
-> 31
: (sqrt 10000000000000000000000000000000000000000)
-> 100000000000000000000
(stamp ['dat 'tim]) -> sym
- Returns a date-time string in the form "YYYY-MM-DD HH:MM:SS". If
dat and/or tim is missing, the current date or time is
used. See also date and time.
: (stamp)
-> "2000-09-12 07:48:04"
: (stamp (date) 0)
-> "2000-09-12 00:00:00"
: (stamp (date 2000 1 1) (time 12 0 0))
-> "2000-01-01 12:00:00"
(state 'var ((sym|lst sym [. prg]) . prg) ..) -> any
- Implements a finite state machine. The variable
var holds the
current state as a symbolic value. When a clause is found that contains the
current state in its CAAR sym|lst value, and either has no
prg condition in its CDDAR, or that condition returns
non-NIL, the current state will be set to the CADAR
sym of the clause, the body prg in its CDR will be
executed, and the result returned. T is a catch-all for any state.
If no state-condition matches, NIL is returned. See also case and job.
: (de tst ()
(job '((Cnt . 4))
(state '(start)
((start run) (printsp 'start))
((run run (gt0 (dec 'Cnt)))
(printsp 'run) )
((run stop) (printsp 'run))
((stop start) (setq Cnt 4) (println 'stop)) ) ) )
-> tst
: (do 12 (tst))
start run run run run stop
start run run run run stop
-> stop
: (pp 'tst)
(de tst NIL
(job '((Cnt . 4))
(state '(start)
...
-> tst
: (do 3 (tst))
start run run -> run
: (pp 'tst)
(de tst NIL
(job '((Cnt . 2))
(state '(run)
...
-> tst
(stem 'lst 'any ..) -> lst
- Returns the tail of
lst that does not contain any of the
any arguments. (stem 'lst 'any ..) is equivalent to
(last (split 'lst 'any ..)). See also tail and split.
: (stem (chop "abc/def\\ghi") "/" "\\")
-> ("g" "h" "i")
(step 'lst ['flg]) -> any
- Single-steps iteratively through a database tree.
lst is a
structure as received from init. If
flg is non-NIL, partial keys are skipped. See also
tree, leaf and fetch.
: (setq Q (init (tree 'nr '+Item) 3 5))
-> (((3 . 5) ((3 NIL . {3-3}) (4 NIL . {3-4}) (5 NIL . {3-5}) (6 NIL . {3-6}) (7 NIL . {3-8}))))
: (get (step Q) 'nr)
-> 3
: (get (step Q) 'nr)
-> 4
: (get (step Q) 'nr)
-> 5
: (get (step Q) 'nr)
-> NIL
(stk any ..) -> T
- Displays a dump of the internal runtime stack to standard error. All
(unevaluated)
any arguments are printed as a header, then each
stack entry is printed per line, preceded by its (hexadecimal) address. See also
env.
: (cons 'A (stk Test))
(Test)
BFFFF69C A
BFFFF70C (cons 'A (stk Test))
-> (A . T)
(store 'tree 'any1 'any2 ['(num1 . num2)])
- Stores a value
any2 for the key any1 in a database
tree. num1 is a database file number, as used in new (defaulting to 1), and num2 a
database block size (defaulting to 256). When any2 is
NIL, the corresponding entry is deleted from the tree. See also
tree and fetch.
: (store (tree 'nr '+Item) 2 '{3-2})
(str 'sym ['sym1]) -> lst
(str 'lst) -> sym
- In the first form, the string
sym is parsed into a list. This
mechanism is also used by load. If
sym1 is given, it should specify a set of characters, and
str will then return a list of tokens analog to read. The second form does the reverse
operation by building a string from a list. See also any, name and sym.
: (str "a (1 2) b")
-> (a (1 2) b)
: (str '(a "Hello" DEF))
-> "a \"Hello\" DEF"
: (str "a*3+b*4" "_")
-> (a * 3 + b * 4)
(strDat 'sym) -> dat
- Converts a string
sym in the date format of the current
locale to a date. See also expDat, $dat and datStr.
: (strDat "2007-06-01")
-> 733134
: (strDat "01.06.2007")
-> NIL
: (locale "DE" "de")
-> NIL
: (strDat "01.06.2007")
-> 733134
: (strDat "1.6.2007")
-> 733134
(strip 'any) -> any
- Strips all leading
quote symbols from any.
: (strip 123)
-> 123
: (strip '''(a))
-> (a)
: (strip (quote quote a b c))
-> (a b c)
(str? 'any) -> sym | NIL
- Returns the argument
any when it is a transient symbol
(string), otherwise NIL. See also sym?, box? and ext?.
: (str? 123)
-> NIL
: (str? '{ABC})
-> NIL
: (str? 'abc)
-> NIL
: (str? "abc")
-> "abc"
(sub? 'sym1 'sym2) -> flg
- Returns non-
NIL when the name of the first symbol
sym1 is a substring of the name of the second symbol
sym2. See also pre?.
: (sub? "def" "abcdef")
-> T
: (sub? "abb" "abcdef")
-> NIL
: (sub? "" "abcdef")
-> T
(subr 'sym) -> num
- Converts a Lisp-function that was previously converted with
expr back to a C-function.
: sqrt
-> 67325664
: (expr 'sqrt)
-> (@ (pass $134533847))
: (subr 'sqrt)
-> 67325664
(sum 'fun 'lst ..) -> num
- Applies
fun to each element of lst. When
additional lst arguments are given, their elements are also passed
to fun. Returns the sum of all numeric values returned from
fun.
: (setq A 1 B 2 C 3)
-> 3
: (sum val '(A B C))
-> 6
: (sum # Total size of symbol list values
'((X)
(and (pair (val X)) (size @)) )
(what) )
-> 32021
(super ['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
superclass(es) of the class where the current method was found. See also
OO Concepts, extra, method, meth, send and try.
(dm stop> () # 'stop>' method of current class
(super) # Call the 'stop>' method of the superclass
... ) # other things
(sym 'any) -> sym
- Generate the printed representation of
any into the name of a
new symbol sym. See also any, name and str.
: (sym '(abc "Hello" 123))
-> "(abc \"Hello\" 123)"
(sym? 'any) -> flg
- Returns
T when the argument any is a symbol. See
also str?, box? and ext?.
: (sym? 'a)
-> T
: (sym? NIL)
-> T
: (sym? 123)
-> NIL
: (sym? '(a b))
-> NIL
(sync) -> flg
- Waits for pending data from all family processes. While other processes are
still sending data (via the
tell
mechanism), a select system call is executed for all file
descriptors and timers in the VAL of the global variable *Run. See also key and wait.
: (or (lock) (sync)) # Ensure database consistency
-> T # (numeric process-id if lock failed)
(sys 'any ['any]) -> sym
- Returns or sets a system environment variable.
: (sys "TERM") # Get current value
-> "xterm"
: (sys "TERM" "vt100") # Set new value
-> "vt100"
: (sys "TERM")
-> "vt100"