*Adr
- A global variable holding the IP address of last recently accepted client.
See also
listen and accept.
: *Adr
-> "127.0.0.1"
(alarm 'cnt . prg) -> cnt
- Sets an alarm timer scheduling
prg to be executed after
cnt seconds, and returns the number of seconds remaining until any
previously scheduled alarm was due to be delivered. Calling (alarm
0) will cancel an alarm.
: (prinl (tim$ (time) T)) (alarm 10 (prinl (tim$ (time) T)))
16:36:14
-> 0
: 16:36:24
: (alarm 10 (bye 0))
-> 0
$
*Allow
- A global variable holding allowed access patterns. If its value is
non-
NIL, it should contain a list where the CAR is an idx tree of allowed items, and the CDR a list of
prefix strings. See also allow,
allowed and pre?.
: (allowed ("app/" "img/") # Initialize
"@start" "@stop" "favicon.ico" "lib.css" "@psh" )
-> NIL
: (allow "@myFoo") # additional item
-> "@myFoo"
: (allow "myDir/" T) # additional prefix
-> "myDir/"
: *Allow
-> (("@stop" ("@psh" ("@myFoo") "@start") "favicon.ico" NIL "lib.css") "app/" "img/" "myDir/")
: (idx *Allow) # items
-> ("@myFoo" "@psh" "@start" "@stop" "favicon.ico" "lib.css")
: (cdr *Allow) # prefixes
-> ("app/" "img/" "myDir/")
(abs 'num) -> num
- Returns the absolute value of the
num argument.
: (abs -7)
-> 7
: (abs 7)
-> 7
(accept 'cnt) -> cnt | NIL
- Accepts a connection on descriptor
cnt (as received by port), and returns the new socket descriptor
cnt. The global variable *Adr is set to the IP address
of the client. See also listen,
connect and *Adr.
: (setq *Socket
(accept (port 6789)) ) # Accept connection at port 6789
-> 4
(accu 'var 'any 'num)
- Accumulates
num into a sum, using the key any in
an association list stored in var. See also assoc.
: (off Sum)
-> NIL
: (accu 'Sum 'a 1)
-> (a . 1)
: (accu 'Sum 'a 5)
-> 6
: (accu 'Sum 22 100)
-> (22 . 100)
: Sum
-> ((22 . 100) (a . 6))
(align 'cnt 'any) -> sym
(align 'lst 'any ..) -> sym
- Returns a transient symbol with all
any arguments packed in an aligned format. In the first form,
any will be left-aligned if cnt ist negative,
otherwise right-aligned. In the second form, all any arguments are
packed according to the numbers in lst. See also tab, center and wrap.
: (align 4 "a")
-> " a"
: (align -4 12)
-> "12 "
: (align (4 4 4) "a" 12 "b")
-> " a 12 b"
(all ['T | 0]) -> lst
- Returns a list of all internal symbols in
the system (if called without arguments, or with
NIL). Otherwise
(if the argument is T), all current transient symbols are returned. Else all current
external symbols are returned.
: (all) # All internal symbols
-> (inc> leaf nil inc! accept ...
# Find all symbols starting with an underscore character
: (filter '((X) (= "_" (car (chop X)))) (all))
-> (_put _nacs _oct _lintq _lst _map _iter _dbg2 _getLine _led ...
(allow 'sym ['flg]) -> sym
- Maintains an index structure of allowed access patterns in the global
variable
*Allow. If the value of
*Allow is non-NIL, sym is added to the
idx tree in the CAR of
*Allow (if flg is NIL), or to the list of
prefix strings (if flg is non-NIL). See also allowed.
: *Allow
-> (("@stop" ("@psh" NIL "@start") "favicon.ico" NIL "lib.css") "app/" "img/")
: (allow "@myFoo") # additionally allowed item
-> "@myFoo"
: (allow "myDir/" T) # additionally allowed prefix
-> "myDir/"
(allowed lst [sym ..])
- Creates an index structure of allowed access patterns in the global variable
*Allow. lst should
consist of prefix strings (to be checked at runtime with pre?), and the sym arguments
should specify the initially allowed items. See also allow.
: (allowed ("app/" "img/") # allowed prefixes
"@start" "@stop" "favicon.ico" "lib.css" "@psh" ) # allowed items
-> NIL
(and 'any ..) -> any
- Logical AND. The expressions
any are evaluated from left to
right. If NIL is encountered, NIL is returned
immediately. Else the result of the last expression is returned.
: (and (= 3 3) (read))
abc # User input
-> abc
: (and (= 3 4) (read))
-> NIL
(any 'sym) -> any
- Parses
any from the name of sym. See also sym and str.
: (any "(a b # Comment^Jc d)")
-> (a b c d)
: (any "\"A String\"")
-> "A String"
(append 'lst ..) -> lst
- Appends all argument lists. See also
conc, insert, delete and remove.
: (append '(a b c) (1 2 3))
-> (a b c 1 2 3)
: (append (1) (2) (3) 4)
-> (1 2 3 . 4)
(apply 'fun 'lst ['any ..]) -> any
- Applies
fun to lst. If additional any
arguments are given, they are applied as leading elements of lst.
(apply 'fun 'lst 'any1 'any2) is equivalent to (apply 'fun
(cons 'any1 'any2 'lst)).
: (apply + (1 2 3))
-> 6
: (apply * (5 6) 3 4)
-> 360
: (apply '((X Y Z) (* X (+ Y Z))) (3 4 5))
-> 27
: (apply println (3 4) 1 2)
1 2 3 4
-> 4
(arg ['cnt]) -> any
- Can only be used inside functions with a variable number of arguments (with
@). If cnt is not given, the value that was returned
from the last call to next) is returned. Otherwise, the
cnt'th remaining argument is returned. See also args, next, rest and pass.
: (de foo @ (println (next) (arg))) # Print argument twice
-> foo
: (foo 123)
123 123
-> 123
: (de foo @
(println (arg 1) (arg 2))
(println (next))
(println (arg 1) (arg 2)) )
-> foo
: (foo 'a 'b 'c)
a b
a
b c
-> c
(args) -> flg
- Can only be used inside functions with a variable number of arguments (with
@). Returns T when there are more arguments to be
fetched from the internal list. See also next, arg, rest and pass.
: (de foo @ (println (args))) # Test for arguments
-> foo
: (foo) # No arguments
NIL
-> NIL
: (foo NIL) # One argument
T
-> T
: (foo 123) # One argument
T
-> T
(argv [sym ..] [. sym]) -> lst|sym
- If called without arguments,
argv returns a list of strings
containing all remaining command line arguments. Otherwise, the sym
arguments are subsequently bound to the command line arguments. A hyphen
"-" can be used to stop loading further arguments. See
also Invocation and opt.
$ ./p -"println 'Ok" - abc 123
Ok
: (argv)
-> ("abc" "123")
: (argv A B)
-> "123"
: A
-> "abc"
: B
-> "123"
: (argv . Lst)
-> ("abc" "123")
: Lst
-> ("abc" "123")
(as 'any1 . any2) -> any2 | NIL
- Returns
any2 unevaluated when any1 evaluates to
non-NIL. Otherwise NIL is returned. (as Flg A B
C) is equivalent to (and Flg '(A B C)). See also quote.
: (as (= 3 3) A B C)
-> (A B C)
(asoq 'any 'lst) -> lst
- Searches an association list. Returns the first element from
lst with any as its CAR, or
NIL if no match is found. == is used for comparison (pointer equality). See
also assoc, delq, memq and mmeq.
: (asoq 999 '((999 1 2 3) (b . 7) ("ok" "Hello")))
-> NIL
: (asoq 'b '((999 1 2 3) (b . 7) ("ok" "Hello")))
-> (b . 7)
(assoc 'any 'lst) -> lst - Searches an
association list. Returns the first element from
lst with its
CAR equal to any, or NIL if no match is
found. See also asoq.
: (assoc "b" '((999 1 2 3) ("b" . 7) ("ok" "Hello")))
-> ("b" . 7)
: (assoc 999 '((999 1 2 3) ("b" . 7) ("ok" "Hello")))
-> (999 1 2 3)
: (assoc 'u '((999 1 2 3) ("b" . 7) ("ok" "Hello")))
-> NIL
(at '(cnt1 . cnt2) . prg) -> any
- Increments
cnt1 (destructively), and returns NIL
when it is less than cnt2. Otherwise, cnt1 is reset to
zero and prg is executed. Returns the result of prg.
: (do 11 (prin ".") (at (0 . 3) (prin "!")))
...!...!...!..-> NIL
(atom 'any) -> flg
- Returns
T when the argument any is an atom (a
number or a symbol). See also pair.
: (atom 123)
-> T
: (atom 'a)
-> T
: (atom NIL)
-> T
: (atom (123))
-> NIL
(aux 'var 'cls ['hook] 'any ..) -> sym
- Returns a database object of class
cls, where the value for
var corresponds to any and the following arguments.
var, cls and hook should specify a
tree for cls or one of
its superclasses, for a relation with auxiliary keys. aux is simlar
to - but faster than - db, because it can use a single tree access.
See also db, collect, fetch, init and step.
(class +PS +Entity)
(rel par (+Dep +Joint) (sup) ps (+Part)) # Part
(rel sup (+Aux +Ref +Link) (par) NIL (+Supp))# Supplier
...
(aux 'sup '+PS # Access PS object
(db 'nr '+Supp 1234)
(db 'nr '+Part 5678) )