I

(id 'num 'num) -> sym
(id 'sym [NIL]) -> num
(id 'sym T) -> (num . num)
Converts two numbers to an external symbol, or an external symbol to a number or a pair of numbers.


: (id 1 2)
-> {1-2}
: (id '{1-2})
-> 2
: (id '{1-2} T)
-> (1 . 2)
(idx 'var 'any 'flg) -> lst
(idx 'var 'any) -> lst
(idx 'var) -> lst
Maintains an index tree in var, and checks for the existence of any. If any is contained in var, the corresponding subtree is returned, otherwise NIL. In the first form, any is destructively inserted into the tree if flg is non-NIL (and any was not already there), or deleted from the tree if flg is NIL. The second form only checks for existence, but does not change the index tree. In the third form (when called with a single var argument) the contents of the tree are returned as a sorted list. If all elements are inserted in sorted order, the tree degenerates into a linear list. See also lup, sort, balance and member.


: (idx 'X 'd T)                              # Insert data
-> NIL
: (idx 'X 2 T)
-> NIL
: (idx 'X '(a b c) T)
-> NIL
: (idx 'X 17 T)
-> NIL
: (idx 'X 'A T)
-> NIL
: (idx 'X 'd T)
-> (d (2 NIL 17 NIL A) (a b c))              # 'd' already existed
: (idx 'X T T)
-> NIL
: X                                          # View the index tree
-> (d (2 NIL 17 NIL A) (a b c) NIL T)
: (idx 'X 'A)                                # Check for 'A'
-> (A)
: (idx 'X 'B)                                # Check for 'B'
-> NIL
: (idx 'X)
-> (2 17 A d (a b c) T)                      # Get list
: (idx 'X 17 NIL)                            # Delete '17'
-> (17 NIL A)
: X
-> (d (2 NIL A) (a b c) NIL T)               # View it again
: (idx 'X)
-> (2 A d (a b c) T)                         # '17' is deleted
(if 'any1 'any2 . prg) -> any
Conditional execution: If the condition any1 evaluates to non-NIL, any2 is evaluated and returned. Otherwise, prg is executed and the result returned. See also cond, when and if2.


: (if (> 4 3) (println 'Ok) (println 'Bad))
Ok
-> Ok
: (if (> 3 4) (println 'Ok) (println 'Bad))
Bad
-> Bad
(if2 'any1 'any2 'any3 'any4 'any5 . prg) -> any
Four-way conditional execution for two conditions: If both conditions any1 and any2 evaluate to non-NIL, any3 is evaluated and returned. Otherwise, any4 or any5 is evaluated and returned if any1 or any2 evaluate to non-NIL, respectively. If none of the conditions evaluate to non-NIL, prg is executed and the result returned. See also if and cond.


: (if2 T T 'both 'first 'second 'none)
-> both
: (if2 T NIL 'both 'first 'second 'none)
-> first
: (if2 NIL T 'both 'first 'second 'none)
-> second
: (if2 NIL NIL 'both 'first 'second 'none)
-> none
(ifn 'any1 'any2 . prg) -> any
Conditional execution ("If not"): If the condition any1 evaluates to NIL, any2 is evaluated and returned. Otherwise, prg is executed and the result returned.


: (ifn (= 3 4) (println 'Ok) (println 'Bad))
Ok
-> Ok
(in 'any . prg) -> any
Opens any as input channel during the execution of prg. The current input channel will be saved and restored appropriately. If the argument is NIL, standard input is used. If the argument is a symbol, it is used as a file name (opened for reading and writing if the first character is "+"). If it is a positive number, it is used as the descriptor of an open file. If it is a negative number, the saved input channel such many levels above the current one is used. Otherwise (if it is a list), it is taken as a command with arguments, and a pipe is opened for input. See also ipid, call, load, file, out, pipe and ctl.


: (in "a" (list (read) (read) (read)))    # Read three items from file "a"
-> (123 (a b c) def)
(inc 'num) -> num
(inc 'var ['num]) -> num
The first form returns the value of num incremented by 1. The second form increments the VAL of var by 1, or by num. If the first argument is NIL, it is returned immediately. (inc 'num) is equivalent to (+ 'num 1) and (inc 'var) is equivalent to (set 'var (+ var 1)). See also dec and +.


: (inc 7)
-> 8
: (inc -1)
-> 0
: (zero N)
-> 0
: (inc 'N)
-> 1
: (inc 'N 7)
-> 8
: N
-> 8

: (setq L (1 2 3 4))
-> (1 2 3 4)
: (inc (cdr L))
-> 3
: L
-> (1 3 3 4)
(index 'any 'lst) -> cnt | NIL
Returns the cnt position of any in lst, or NIL if it is not found. See also offset.


: (index 'c '(a b c d e f))
-> 3
: (index '(5 6) '((1 2) (3 4) (5 6) (7 8)))
-> 3
(info 'any) -> (cnt|T dat . tim)
Returns information about a file with the name any: The current size cnt in bytes, and the modification date and time (UTC). For directories, T is returned instead of the a size. See also dir, date, time and lines.


$ ls -l x.l
-rw-r--r--   1 abu      users         208 Jun 17 08:58 x.l
$ ./p dbg.l
: (info "x.l")
-> (208 730594 . 32315)
: (stamp 730594 32315)
-> "2000-06-17 08:58:35"
(init 'tree ['any1] ['any2]) -> lst
Initializes a structure for stepping iteratively through a database tree. any1 and any2 may specify a range of keys. If any2 is greater than any1, the traversal will be in opposite direction. See also tree, step, iter and scan.


: (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}))))
(insert 'cnt 'lst 'any) -> lst
Inserts any into lst at position cnt. See also remove, place, append, delete and replace.


: (insert 3 '(a b c d e) 777)
-> (a b 777 c d e)
: (insert 1 '(a b c d e) 777)
-> (777 a b c d e)
: (insert 9 '(a b c d e) 777)
-> (a b c d e 777)
(intern 'sym) -> sym
Creates or finds an internal symbol. If a symbol with the name sym is already intern, it is returned. Otherwise, sym is interned and returned. See also zap, extern and ====.


: (intern "abc")
-> abc
: (intern 'car)
-> car
: ((intern (pack "c" "a" "r")) (1 2 3))
-> 1
(ipid) -> pid | NIL
Returns the corresponding process ID when the current input channel is reading from a pipe, otherwise NIL. See also opid, in, pipe and load.


: (in '(ls "-l") (println (line T)) (kill (ipid)))
"total 7364"
-> T
(isa 'cls|typ 'obj) -> obj | NIL
Returns obj when it is an object that inherits from cls or type. See also OO Concepts, class, type, new and object.


: (isa '+Address Obj)
-> {1-17}
: (isa '(+Male +Person) Obj)
-> NIL
(iter 'tree ['fun] ['any1] ['any2] ['flg])
Iterates through a database tree by applying fun to all values. fun 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, scan, init and step.


: (iter (tree 'nr '+Item))
{3-1}
{3-2}
{3-3}
{3-4}
{3-5}
{3-6}
{3-8}
-> {7-1}
: (iter (tree 'nr '+Item) '((This) (println (: nm))))
"Main Part"
"Spare Part"
"Auxiliary Construction"
"Enhancement Additive"
"Metal Fittings"
"Gadget Appliance"
"Testartikel"
-> {7-1}