- *Msg
- A global variable holding the last recently issued error message. See also
Error Handling,*Errand^.
: (+ 'A 2)
!? (+ 'A 2)
A -- Number expected
?
:
: *Msg
-> "Number expected"
 
- +Mis
- Prefix class to explicitly specify validation functions for +relations. Expects a function that takes
a value and an entity object, and returnsNILif everything is
correct, or an error string. See also Database.
(class +Ord +Entity)            # Order class
(rel pos (+Mis +List +Joint)    # List of positions in that order
   ((Val Obj)
      (when (memq NIL Val)
         "There are empty positions" ) )
   ord (+Pos) )
 
- (macro prg) -> any
- Substitues all pat?symbols inprg(usingfill), and
executes the result withrun. Used
occasionally to call functions which otherwise do not evaluate their arguments.
: (de timerMessage (@N . @Prg)
   (setq @N (- @N))
   (macro
      (task @N 0 . @Prg) ) )
-> timerMessage
: (timerMessage 6000 (println 'Timer 6000))
-> (-6000 0 (println 'Timer 6000))
: (timerMessage 12000 (println 'Timer 12000))
-> (-12000 0 (println 'Timer 12000))
: (more *Run)
(-12000 2616 (println 'Timer 12000))
(-6000 2100 (println 'Timer 6000))
-> NIL
: Timer 6000
Timer 12000
...
 
- (made ['lst1 ['lst2]]) -> lst
- Initializes a new list value for the current makeenvironment. All list elements already
produced withchain,linkandyokeare discarded, andlst1is
used instead. Optionally,lst2can be specified as the new linkage
cell, otherwise the last cell oflst1is used. When called without
arguments,madedoes not modify the environment. In any case, the
current list is returned.
: (make
   (link 'a 'b 'c)         # Link three items
   (println (made))        # Print current list (a b c)
   (made (1 2 3))          # Discard it, start new with (1 2 3)
   (link 4) )              # Link 4
(a b c)
-> (1 2 3 4)
 
- (mail 'any 'cnt|lst 'sym1|lst2 'sym2|lst3 'sym3 'lst4 . prg)'
- Sends an eMail via SMTP to a mail server at host any, portcnt. If the second argument is a list, it should be a structure(user password . port), and "@bin/ssl" will be called to establish
an encrypted connection.sym1|lst2should be the "from" address (or
a cons pair of "reply-to" and "from"),sym2|lst3the "to"
address(es), andsym3the subject.lst4is a list of
attachments, each one specified by three elements for path, name and mime type.prggenerates the mail body withprEval. See alsoconnect.
(mail "localhost" 25                               # Local mail server
   "a@bc.de"                                       # "From" address
   "abu@software-lab.de"                           # "To" address
   "Testmail"                                      # Subject
   (quote
      "img/go.png" "go.png" "image/png"            # First attachment
      "img/7fach.gif" "7fach.gif" "image/gif" )    # Second attachment
   "Hello,"                                        # First line
   NIL                                             # (empty line)
   (prinl (pack "This is mail #" (+ 3 4))) )       # Third line
 
- (make .. [(made 'lst ..)] .. [(link 'any ..)] ..) -> any
- Initializes and executes a list-building process with the made,chain,linkandyokefunctions, and returns the result list.
For efficiency, pointers to the head and the tail of the list are maintained
internally.
: (make (link 1) (link 2 3) (link 4))
-> (1 2 3 4)
: (make (made (1 2 3)) (link 4))
-> (1 2 3 4)
 
- (map 'fun 'lst ..) -> lst
- Applies funtolstand all successive CDRs. When
additionallstarguments are given, they are passed tofunin the same way. Returns the result of the last application.
See alsomapc,maplist,mapcar,mapcon,mapcanandfilter.
: (map println (1 2 3 4) '(A B C))
(1 2 3 4) (A B C)
(2 3 4) (B C)
(3 4) (C)
(4) NIL
-> NIL
 
- map/3
- Pilog predicate that returns a list and
subsequent CDRs of that list, after applying the getalgorithm to that object and the following
arguments. Often used in database queries. See alsolst/3.
: (? (db nr +Ord 1 @Ord) (map @L @Ord pos))
 @Ord={B7} @L=({A1} {A2} {A3})
 @Ord={B7} @L=({A2} {A3})
 @Ord={B7} @L=({A3})
-> NIL
 
- (mapc 'fun 'lst ..) -> any
- Applies funto each element oflst. When
additionallstarguments are given, their elements are also passed
tofun. Returns the result of the last application. See alsomap,maplist,mapcar,mapcon,mapcanandfilter.
: (mapc println (1 2 3 4) '(A B C))
1 A
2 B
3 C
4 NIL
-> NIL
 
- (mapcan 'fun 'lst ..) -> lst
- Applies funto each element oflst. When
additionallstarguments are given, their elements are also passed
tofun. Returns a (destructively) concatenated list of all results.
See alsomap,mapc,maplist,mapcar,mapcon,filter.
: (mapcan reverse '((a b c) (d e f) (g h i)))
-> (c b a f e d i h g)
 
- (mapcar 'fun 'lst ..) -> lst
- Applies funto each element oflst. When
additionallstarguments are given, their elements are also passed
tofun. Returns a list of all results. See alsomap,mapc,maplist,mapcon,mapcanandfilter.
: (mapcar + (1 2 3) (4 5 6))
-> (5 7 9)
: (mapcar + (1 2 3) 5)
-> (6 7 8)
: (mapcar '((X Y) (+ X (* Y Y))) (1 2 3 4) (5 6 7 8))
-> (26 38 52 68)
 
- (mapcon 'fun 'lst ..) -> lst
- Applies funtolstand all successive CDRs. When
additionallstarguments are given, they are passed tofunin the same way. Returns a (destructively) concatenated list of
all results. See alsomap,mapc,maplist,mapcar,mapcanandfilter.
: (mapcon copy '(1 2 3 4 5))
-> (1 2 3 4 5 2 3 4 5 3 4 5 4 5 5)
 
- (maplist 'fun 'lst ..) -> lst
- Applies funtolstand all successive CDRs. When
additionallstarguments are given, they are passed tofunin the same way. Returns a list of all results. See alsomap,mapc,mapcar,mapcon,mapcanandfilter.
: (maplist cons (1 2 3) '(A B C))
-> (((1 2 3) A B C) ((2 3) B C) ((3) C))
 
- (maps 'fun 'sym ['lst ..]) -> any
- Applies funto all properties ofsym. When
additionallstarguments are given, their elements are also passed
tofun. Returns the result of the last application. Note that
'maps' should only be used when the property list is not modified byfun. Otherwise it is better to use a loop over the result ofgetl. See alsoputl.
: (put 'X 'a 1)
-> 1
: (put 'X 'b 2)
-> 2
: (put 'X 'flg T)
-> T
: (getl 'X)
-> (flg (2 . b) (1 . a))
: (maps println 'X '(A B))
flg A
(2 . b) B
(1 . a) NIL
-> NIL
 
- (mark 'sym|0 ['NIL | 'T | '0]) -> flg
- Tests, sets or resets a mark for symin the database (for a
second argument ofNIL,Tor0,
respectively), and returns the old value. The marks are local to the current
process (not stored in the database), and vanish when the process terminates. If
the first argument is zero, all marks are cleared.
: (pool "db")
-> T
: (mark '{1} T)      # Mark
-> NIL
: (mark '{1})        # Test
-> T                 # -> marked
: (mark '{1} 0)      # Unmark
-> T
: (mark '{1})        # Test
-> NIL               # -> unmarked
 
- (match 'lst1 'lst2) -> flg
- Takes lst1as a pattern to be matched againstlst2, and returnsTwhen successful. Atoms must be
equal, and sublists must match recursively. Symbols in the pattern list with
names starting with an at-mark "@" (seepat?) are taken as wildcards. They can match
zero, one or more elements, and are bound to the corresponding data. See alsochop,splitandfill.
: (match '(@A is @B) '(This is a test))
-> T
: @A
-> (This)
: @B
-> (a test)
: (match '(@X (d @Y) @Z) '((a b c) (d (e f) g) h i))
-> T
: @X
-> ((a b c))
: @Y
-> ((e f) g)
: @Z
-> (h i)
 
- (max 'any ..) -> any
- Returns the largest of all anyarguments. See also min and Comparing.
: (max 2 'a 'z 9)
-> z
: (max (5) (2 3) 'X)
-> (5)
 
- (maxKey 'tree ['any1 ['any2]]) -> any
- Returns the largest key in a database tree. If a minimal key
any1and/or a maximal keyany2is given, the largest
key from that range is returned. See alsotree,leaf,minKeyandgenKey.
: (maxKey (tree 'nr '+Item))
-> 7
: (maxKey (tree 'nr '+Item) 3 5)
-> 5
 
- (maxi 'fun 'lst ..) -> any
- Applies funto each element oflst. When
additionallstarguments are given, their elements are also passed
tofun. Returns that element fromlstfor whichfunreturned a maximal value (and stores the maximal value in the
global variable@@). See alsominiandsort.
: (setq A 1  B 2  C 3)
-> 3
: (maxi val '(A B C))
-> C
: (maxi                          # Symbol with largest list value
   '((X)
      (and (pair (val X)) (size @)) )
   (all) )
-> pico
 
- (member 'any 'lst) -> any
- Returns the tail of lstthat starts withanywhenanyis a member oflst, otherwiseNIL.
See alsomemq,assocandidx.
: (member 3 (1 2 3 4 5 6))
-> (3 4 5 6)
: (member 9 (1 2 3 4 5 6))
-> NIL
: (member '(d e f) '((a b c) (d e f) (g h i)))
-> ((d e f) (g h i))
 
- member/2
- Pilog predicate that succeeds if the the first
argument is a member of the list in the second argument. See also equal/2andmember.
:  (? (member @X (a b c)))
 @X=a
 @X=b
 @X=c
-> NIL
 
- (memq 'any 'lst) -> any
- Returns the tail of lstthat starts withanywhenanyis a member oflst, otherwiseNIL.==is used for comparison (pointer
equality). See alsomember,mmeq,asoq,push1q,delqand Comparing.
: (memq 'c '(a b c d e f))
-> (c d e f)
: (memq (2) '((1) (2) (3)))
-> NIL
 
- (meta 'obj|typ 'sym ['sym2|cnt ..]) -> any
- Fetches a property value any, by searching the property lists
of the classes and superclasses ofobj, or the classes intyp, for the property keysym, and by applying thegetalgorithm to the following optional
arguments. See alsovar:.
: (setq A '(B))            # Be 'A' an object of class 'B'
-> (B)
: (put 'B 'a 123)
-> 123
: (meta 'A 'a)             # Fetch 'a' from 'B'
-> 123
 
- (meth 'obj ['any ..]) -> any
- This function is usually not called directly, but is used by  dmas a template to initialize theVALof message symbols. It searches for itself in the methods ofobjand its classes and superclasses, and executes that method. An
error"Bad message"is issued if the search is unsuccessful. See
also OO Concepts,method,sendandtry.
: meth
-> 67283504    # Value of 'meth'
: rel>
-> 67283504    # Value of any message
 
- (method 'msg 'obj) -> fun
- Returns the function body of the method that would be executed upon sending
the message msgto the objectobj. If the message
cannot be located inobj, its classes and superclasses,NILis returned. See also OO Concepts,send,try,meth,super,extra,class.
: (method 'mis> '+Number)
-> ((Val Obj) (and Val (not (num? Val)) "Numeric input expected"))
 
- (methods 'sym) -> lst
- (Debug mode only) Returns a list of method specifications for the object or
class sym, as they are inherited fromsym's classes
and superclasses. See also OO Concepts,dep,classandcan.
: (more (methods '+Joint))
(keep> . +Joint)
(lose> . +Joint)
(rel> . +Joint)
(mis> . +Joint)
(T . +Joint)
(print> . +relation)
(zap> . +relation)
(del> . +relation)
(put> . +relation)
(has> . +relation)
(ele> . +relation)
 
- (min 'any ..) -> any
- Returns the smallest of all anyarguments. See also max and Comparing.
: (min 2 'a 'z 9)
-> 2
: (min (5) (2 3) 'X)
-> X
 
- (minKey 'tree ['any1 ['any2]]) -> any
- Returns the smallest key in a database tree. If a minimal key
any1and/or a maximal keyany2is given, the smallest
key from that range is returned. See alsotree,leaf,maxKeyandgenKey.
: (minKey (tree 'nr '+Item))
-> 1
: (minKey (tree 'nr '+Item) 3 5)
-> 3
 
- (mini 'fun 'lst ..) -> any
- Applies funto each element oflst. When
additionallstarguments are given, their elements are also passed
tofun. Returns that element fromlstfor whichfunreturned a minimal value (and stores the minimal value in the
global variable@@). See alsomaxiandsort.
: (setq A 1  B 2  C 3)
-> 3
: (mini val '(A B C))
-> A
 
- (mix 'lst cnt|'any ..) -> lst
- Builds a list from the elements of the argument lst, as
specified by the followingcnt|'anyarguments. If such an argument
is a positive number, the n'th element fromlstis taken. If it is
a negative number, the n'th CDR. Otherwise that argument is evaluated and the
result is used.
: (mix '(a b c d) 3 4 1 2)
-> (c d a b)
: (mix '(a b c d) -2 1)
-> ((c d) a)
: (mix '(a b c d) 1 'A 4 'D)
-> (a A d D)
 
- (mmeq 'lst 'lst) -> any
- Returns the tail of the second argument lstthat starts with a
member of the first argumentlst, otherwiseNIL.==is used for comparison (pointer
equality). See alsomember,memq,asoqanddelq.
: (mmeq '(a b c) '(d e f))
-> NIL
: (mmeq '(a b c) '(d b x))
-> (b x)
 
- (money 'num ['sym]) -> sym
- Formats a number numinto a digit string with two decimal
places, according to the currentlocale. If an additional currency name is
given, it is appended (separated by a space). See alsotelStr,datStrandformat.
: (money 123456789)
-> "1,234,567.89"
: (money 12345 "EUR")
-> "123.45 EUR"
: (locale "DE" "de")
-> NIL
: (money 123456789 "EUR")
-> "1.234.567,89 EUR"
 
- (more 'lst ['fun]) -> flg
- (more 'cls) -> any
- (Debug mode only) Displays the elements of lst(first form), or
the type and methods ofcls(second form).fundefaults toprint. In the second
form, the method definitions ofclsare pretty-printed withpp. After each step,morewaits for console input, and terminates when a non-empty line is entered. In
that case,Tis returned, otherwise (when end of data is reached)NIL. See alsoqueryandshow.
: (more (all))                         # Display all internal symbols
inc>
leaf
nil
inc!
accept.                                # Stop
-> T
: (more (all) show)                    # 'show' all internal symbols
inc> 67292896
   *Dbg ((859 . "lib/db.l"))
leaf ((Tree) (let (Node (cdr (root Tree)) X) (while (val Node) (setq X (cadr @) Node (car @))) (cddr X)))
   *Dbg ((173 . "lib/btree.l"))
nil 67284680
   T (((@X) (^ @ (not (-> @X)))))
.                                      # Stop
-> T
: (more '+Link)                        # Display a class
(+relation)
(dm mis> (Val Obj)
   (and
      Val
      (nor (isa (: type) Val) (canQuery Val))
      "Type error" ) )
(dm T (Var Lst)
   (unless (=: type (car Lst)) (quit "No Link" Var))
   (super Var (cdr Lst)) )
-> NIL
 
- (msg 'any ['any ..]) -> any
- Prints anywithprint, followed by allanyarguments (printed withprin) and a
newline, to standard error. The firstanyargument is returned.
: (msg (1 a 2 b 3 c) " is a mixed " "list")
(1 a 2 b 3 c) is a mixed list
-> (1 a 2 b 3 c)