- *Led
- (Debug mode only) A global variable holding a (possibly empty)
prgbody that implements a "Line editor". When
non-NIL, it should return a single symbol (string) upon execution.
: (de *Led "(bye)")
# *Led redefined
-> *Led
: $                                    # Exit
 
- +Link
- Class for object relations, a subclass of +relation. Expects a list of classes astypeof the referred database object
(of class+Entity). See also Database.
(rel sup (+Ref +Link) NIL (+CuSu))  # Supplier (class Customer/Supplier)
 
- +List
- Prefix class for a list of identical relations. Objects of that class
maintain a list of Lisp data of uniform type. See also Database.
(rel pos (+List +Joint) ord (+Pos))  # Positions
(rel nm (+List +Ref +String))        # List of indexed strings
(rel val (+Ref +List +Number))       # Indexed list of numeric values
 
- (last 'lst) -> any
- Returns the last element of lst. See alsofinandtail.
: (last (1 2 3 4))
-> 4
: (last '((a b) c (d e f)))
-> (d e f)
 
- (later 'var . prg) -> var
- Executes prgin apipe'ed child process. The return value ofprgwill later be available invar. Note thatlaterusesprandrdto communicate the result, soprgshould not write any data to standard output as a side effect.
: (prog1  # Parallel background calculation of square numbers
   (mapcan '((N) (later (cons) (* N N))) (1 2 3 4))
   (wait NIL (full @)) )
-> (1 4 9 16)
 
- (ld) -> any
- (Debug mode only) loads the last
file edited withviorem.
: (vi 'main)
-> T
: (ld)
# main redefined
-> go
 
- (le0 'any) -> num | NIL
- Returns numwhen the argument is a number less or equal zero,
otherwiseNIL. See alsolt0,ge0,gt0,=0andn0.
: (le0 -2)
-> -2
: (le0 0)
-> 0
: (le0 3)
-> NIL
 
- (leaf 'tree) -> any
- Returns the first leaf (i.e. the value of the smallest key) in a database
tree. See also tree,minKey,maxKeyandstep.
: (leaf (tree 'nr '+Item))
-> {3-1}
: (db 'nr '+Item (minKey (tree 'nr '+Item)))
-> {3-1}
 
- (length 'any) -> cnt | T
- Returns the "length" of any. For numbers this is the number of
decimal digits in the value (plus 1 for negative values), for symbols it is the
number of characters in the name, and for lists it is the number of cells (orTfor circular lists). See alsosizeandbytes.
: (length "abc")
-> 3
: (length "äbc")
-> 3
: (length 123)
-> 3
: (length (1 (2) 3))
-> 3
: (length (1 2 3 .))
-> T
 
- (less 'any) -> any
- (Debug mode only) Returns a reduced form of any, where for each
list and its sublists only the first two elements, possibly followed by.., are retained.
: (less '(a b c d))
-> (a b ..)
: (less '((a b c) ((d e f) g h) i j))
-> ((a b ..) ((d e ..) g ..) ..)
 
- (let sym 'any . prg) -> any
- (let (sym|lst 'any ..) . prg) -> any
- Defines local variables. The value of the symbol sym- or the
values of the symbolssymin the list of the second form - are
saved and the symbols are bound to the evaluatedanyarguments. The
64-bit version also acceptslstarguments in the second form; they
may consist only of symbols and sublists, and match theanyargument (destructuring bind).prgis executed, then the symbols
are restored to their original values. The result ofprgis
returned. It is an error condition to passNILas asymargument. In destructuring patterns,NILdenotes a
"don't care" position. See alsolet?,bind,recur,with,for,jobanduse.
: (setq  X 123  Y 456)
-> 456
: (let X "Hello" (println X))
"Hello"
-> "Hello"
: (let (X "Hello" Y "world") (prinl X " " Y))
Hello world
-> "world"
: X
-> 123
: Y
-> 456
# 64-bit version
: (let (A 1  (B . C) (2 3)  D 4)
   (list A B C D) )
-> (1 2 (3) 4)
: (let (((A . B) (C) . D) '((1 2 3) (4 5 6) 7 8 9))
   (list A B C D) )
-> (1 (2 3) 4 (7 8 9))
: (let (((A . NIL) NIL NIL D) '((1 2 3) (4 5 6) 7 8 9))
   (trail T) )
-> (A 1 D 8)
 
- (let? sym 'any . prg) -> any
- Conditional local variable binding and execution: If anyevaluates toNIL,NILis returned. Otherwise, the
value of the symbolsymis saved andsymis bound to
the evaluatedanyargument.prgis executed, thensymis restored to its original value. The result ofprgis returned. It is an error condition to passNILas thesymargument.(let? sym 'any ..)is equivalent
to(when 'any (let sym @ ..)). See alsolet,bind,jobanduse.
: (setq Lst (1 NIL 2 NIL 3))
-> (1 NIL 2 NIL 3)
: (let? A (pop 'Lst) (println 'A A))
A 1
-> 1
: (let? A (pop 'Lst) (println 'A A))
-> NIL
 
- (lieu 'any) -> sym | NIL
- Returns the argument anywhen it is an external symbol and
currently manifest in heap space, otherwiseNIL. See alsoext?.
: (lieu *DB)
-> {1}
 
- (line 'flg ['cnt ..]) -> lst|sym
- Reads a line of characters from the current input channel. End of line is
recognized as linefeed (hex "0A"), carriage return (hex "0D"), or the
combination of both. (Note that a single carriage return may not work on network
connections, because the character look-ahead to distinguish from
return+linefeed can block the connection.) If flgisNIL, a list of single-character transient symbols is returned. Whencntarguments are given, subsequent characters of the input line
are grouped into sublists, to allow parsing of fixed field length records. Ifflgis non-NIL, strings are returned instead of
single-character lists.NILis returned upon end of file. See alsochar,read,tillandeof.
: (line)
abcdefghijkl
-> ("a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l")
: (line T)
abcdefghijkl
-> "abcdefghijkl"
: (line NIL 1 2 3)
abcdefghijkl
-> (("a") ("b" "c") ("d" "e" "f") "g" "h" "i" "j" "k" "l")
: (line T 1 2 3)
abcdefghijkl
-> ("a" "bc" "def" "g" "h" "i" "j" "k" "l")
 
- (lines 'any ..) -> cnt
- Returns the sum of the number of lines in the files with the names
any, orNILif none was found. See alsoinfo.
: (lines "x.l")
-> 11
 
- (link 'any ..) -> any
- Links one or several new elements anyto the end of the list in
the currentmakeenvironment. This
operation is efficient also for long lists, because a pointer to the last
element of the list is maintained.linkreturns the last linked
argument. See alsoyoke,chainandmade.
: (make
   (println (link 1))
   (println (link 2 3)) )
1
3
-> (1 2 3)
 
- (lint 'sym) -> lst
- (lint 'sym 'cls) -> lst
- (lint '(sym . cls)) -> lst
- (Debug mode only) Checks the function definition or file contents (in the
first form), or the method body of sym (second and third form), for possible
pitfalls. Returns an association list of diagnoses, where varindicates improper variables,dupduplicate parameters,defan undefined function,bndan unbound variable,
anduseunused variables. See alsonoLint,lintAll,debug,traceand*Dbg.
: (de foo (R S T R)     # 'T' is a improper parameter, 'R' is duplicated
   (let N 7             # 'N' is unused
      (bar X Y) ) )     # 'bar' is undefined, 'X' and 'Y' are not bound
-> foo
: (lint 'foo)
-> ((var T) (dup R) (def bar) (bnd Y X) (use N))
 
- (lintAll ['sym ..]) -> lst
- (Debug mode only) Applies linttoallinternal symbols - and optionally
to all filessym- and returns a list of diagnoses. See alsonoLint.
: (more (lintAll "file1.l" "file2.l"))
...
 
- (lisp 'sym ['fun]) -> num
- (64-bit version only) Installs under the tag syma callback
functionfun, and returns a pointernumsuitable to be
passed to a C function via 'native'. IffunisNIL,
the corresponding entry is freed. Maximally 24 callback functions can be
installed that way. 'fun' should be a function of maximally five numbers, and
should return a number. "Numbers" in this context are 64-bit scalars, and may
not only represent integers, but also pointers or other encoded data. See alsonativeandstruct.
(load "lib/native.l")
(gcc "ltest" NIL
   (cbTest (Fun) cbTest 'N Fun) )
long cbTest(int(*fun)(int,int,int,int,int)) {
   return fun(1,2,3,4,5);
}
/**/
: (cbTest
   (lisp 'cbTest
      '((A B C D E)
         (msg (list A B C D E))
         (* A B C D E) ) ) )
(1 2 3 4 5)
-> 120
 
- (list 'any ['any ..]) -> lst
- Returns a list of all anyarguments. See alsocons.
: (list 1 2 3 4)
-> (1 2 3 4)
: (list 'a (2 3) "OK")
-> (a (2 3) "OK")
 
- lst/3
- Pilog predicate that returns subsequent list
elements, after applying the getalgorithm to that object and the following arguments. Often used in database
queries. See alsomap/3.
: (? (db nr +Ord 1 @Ord) (lst @Pos @Ord pos))
 @Ord={3-7} @Pos={4-1}
 @Ord={3-7} @Pos={4-2}
 @Ord={3-7} @Pos={4-3}
-> NIL
 
- (lst? 'any) -> flg
- Returns Twhen the argumentanyis a (possibly
empty) list (NILor a cons pair). See alsopair.
: (lst? NIL)
-> T
: (lst? (1 . 2))
-> T
: (lst? (1 2 3))
-> T
 
- (listen 'cnt1 ['cnt2]) -> cnt | NIL
- Listens at a socket descriptor cnt1(as received byport) for an incoming connection, and returns
the new socket descriptorcnt. While waiting for a connection, aselectsystem call is executed for all file descriptors and timers
in theVALof the global variable*Run. Ifcnt2is
non-NIL, that amount of milliseconds is waited maximally, andNILis returned upon timeout. The global variable*Adris set to the IP address of the client. See alsoaccept,connect,*Adr.
: (setq *Socket
   (listen (port 6789) 60000) )  # Listen at port 6789 for max 60 seconds
-> 4
: *Adr
-> "127.0.0.1"
 
- (lit 'any) -> any
- Returns the literal (i.e. quoted) value of any, byconsing it with thequotefunction if necessary.
: (lit T)
-> T
: (lit 1)
-> 1
: (lit '(1))
-> (1)
: (lit '(a))
-> '(a)
 
- (load 'any ..) -> any
- Loads all anyarguments. Normally, the name of each argument is
taken as a file to be executed in a read-eval loop. The argument semantics are
identical to that ofin, with the
exception that if an argument is a symbol and its first character is a hyphen
'-', then that argument is parsed as an executable list (without the surrounding
parentheses). WhenanyisT, all remaining command
line arguments areloaded recursively. WhenanyisNIL, standard input is read, a prompt is issued before each read
operation, the results are printed to standard output (read-eval-print loop),
andloadterminates when an empty line is entered. In any case,loadterminates upon end of file, or whenNILis read.
The index for transient symbols is cleared before and after the load, so that
all transient symbols in a file have a local scope. If the namespace was
switched (withsymbols) while
executing a file, it is restored to the previous one. Returns the value of the
last evaluated expression. See alsoscript,ipid,call,file,in,outandstr.
: (load "lib.l" "-* 1 2 3")
-> 6
 
- (loc 'sym 'lst) -> sym
- Locates in lstatransientsymbol with the same name assym. Allows to get hold of otherwise inaccessible symbols. See also====.
: (loc "X" curry)
-> "X"
: (== @ "X")
-> NIL
 
- (local) sym|lst -> sym|lst
- Intern symbols locally in the current namespace. (local)expects a single symbol or a list of symbols immediately following in the
current input stream. See alsopico,symbols,importandintern.
: (symbols 'myLib 'pico)
-> (pico)
myLib: (local)
   [bar foo]
-> (myLib pico)
myLib: (de foo (A)  # 'foo' is local to 'myLib'
   ...
myLib: (de bar (B)  # 'bar' is local to 'myLib'
   ...
 
- (locale 'sym1 'sym2 ['sym ..])
- Sets the current locale to that given by the country file sym1and the language filesym2(both located in the "loc/" directory),
and optional application-specific directoriessym. The locale
influences the language, and numerical, date and other formats. See also*Uni,datStr,strDat,expDat,day,telStr,expTeland andmoney.
: (locale "DE" "de" "app/loc/")
-> "Zip"
: ,"Yes"
-> "Ja"
 
- (lock ['sym]) -> cnt | NIL
- Write-locks an external symbol sym(file record locking), or
the whole database root file ifsymisNIL. ReturnsNILif successful, or the ID of the process currently holding the
lock. Whensymis non-NIL, the lock is released at the
next call tocommitorrollback, otherwise only when another
database is opened withpool, or when
the process terminates. See also*Solo.
: (lock '{1})        # Lock single object
-> NIL
: (lock)             # Lock whole database
-> NIL
 
- (loop ['any | (NIL 'any . prg) | (T 'any . prg) ..]) -> any
- Endless loop with multiple conditional exits: The body is executed an
unlimited number of times. If a clause has NILorTas
its CAR, the clause's second element is evaluated as a condition and - if the
result isNILor non-NIL, respectively - theprgis executed and the result returned. See alsodoandfor.
: (let N 3
   (loop
      (prinl N)
      (T (=0 (dec 'N)) 'done) ) )
3
2
1
-> done
 
- (low? 'any) -> sym | NIL
- Returns
anywhen the argument is a string (symbol) that starts with a
lowercase character. See alsolowcandupp?
: (low? "a")
-> "a"
: (low? "A")
-> NIL
: (low? 123)
-> NIL
: (low? ".")
-> NIL
 
- (lowc 'any) -> any
- Lower case conversion: If anyis not a symbol, it is returned
as it is. Otherwise, a new transient symbol with all characters ofany, converted to lower case, is returned. See alsouppc,foldandlow?.
: (lowc 123)
-> 123
: (lowc "ABC")
-> "abc"
 
- (lt0 'any) -> num | NIL
- Returns numwhen the argument is a number and less than zero,
otherwiseNIL. See alsole0,ge0,gt0,=0andn0.
: (lt0 -2)
-> -2
: (lt0 3)
-> NIL
 
- (lup 'lst 'any) -> lst
- (lup 'lst 'any 'any2) -> lst
- Looks up anyin the CAR-elements of cons pairs stored in the
index treelst, as built-up byidx. In the first form, the first found cons
pair is returned, in the second form a list of all pairs whose CAR is in the
rangeany..any2. If the tree is empty,NILis returned immediately. See alsoassoc.
: (idx 'A 'a T)
-> NIL
: (idx 'A (1 . b) T)
-> NIL
: (idx 'A 123 T)
-> NIL
: (idx 'A (1 . a) T)
-> NIL
: (idx 'A (1 . c) T)
-> NIL
: (idx 'A (2 . d) T)
-> NIL
: (idx 'A)
-> (123 a (1 . a) (1 . b) (1 . c) (2 . d))
: (lup A 1)
-> (1 . b)
: (lup A 2)
-> (2 . d)
: (lup A 1 1)
-> ((1 . a) (1 . b) (1 . c))
: (lup A 1 2)
-> ((1 . a) (1 . b) (1 . c) (2 . d))