Lisp2D

Start of the interpreter

> ./lisp2d

  Start without parameters enters into an interactive mode with the function read-eval-print.

> ./lisp2d filename [{ argi }]

  By turns carries out all forms stored in a file filename. Before executing of a file a variable arg links with the list of strings ("filename" "arg1" … "argn").
  In all cases the received result of calculation comes back as a return code of the program if result was value of type char or integer, otherwise a return code - 0.
  Interpreter uses a system multithreading, streams of the POSIX standard.
  The quantity of working streams will be equal to quantity of processors. The quantity of calculations history records is 12.
  The history of calculations at programming gives the big advantage. All knots of a course of the program are visible and the site in which there was an unexpected operation is visible. Speed of a program debugging increases 10 times.
  (nil setdebug),(nil setdebug false),(nil setdebug 0) - cancels record in history of calculations. Speed of the program increases.
  (nil setdebug number) - changes the size of history of calculations.
  (nil getdebug) - returns the size of history of calculations.
  (cerr error) - to see the history of calculations.

Syntax

(obj … obj) - list
#(obj … obj) vector (array)

"ab…z" - string
The string having special characters is created by means of a sign \
"the \"abc\" is string" - it is one string
"\\" - string from one character \

;abc…z - the comment up to the end of a line
'obj - prohibition of calculations.
`obj - back quote (partial prohibition of calculations).
,obj - calculation inside `.
,@obj - calculation with an insertion inside `.
(obj . obj) - dot pair

#\c - letter (character) c
#\space - space
#\tab - tabulator
#\enter
#\escape

Keywords and variable environments

&rest - Connects a variable with the list of the staying arguments
(nil defmethod m (a &rest b) (cout writeln a b))
(nil m 1 2 3 4) →
1
(2 3 4)
&whole - connects a variable with an original call where are not calculated neither object nor arguments.
>(nil defmethod t (&whole w) (cout writeln "w=" w))
(lambda (&whole w) (cout writeln "w=" w))
>((10 + 10) t)
w=((10 + 10) t)

nil nothing or empty list

true- The logic truth

false - The logic false

Global variables:

package - The variable, contacts a loaded file

arg - the variable, link to the list of strings, transmitted at interpreter starting.

pi=3.141592653589…    π

e=2.718281828459…

cin - standard stream of input

cout - standard stream of an output

cerr - standard stream for error messages.

  xk-enter, xk-home, xk-end, xk-left, xk-right, xk-up, xk-down, xk-page-up, xk-page-down, xk-insert, xk-delete, xk-caps-lock, xk-shift-l, xk-shift-r, xk-control-l, xk-control-r, xk-alt-l, xk-alt-r, xk-f1, xk-f2, xk-f3, xk-f4, xk-f5, xk-f6, xk-f7, xk-f8, xk-f9, xk-f10, xk-f11, xk-f12, xk-backspace, xk-undo, xk-num-lock, xk-kp-multiply, xk-space, xk-numbersign, xk-question - codes of the pressed keys for function (window read-keyb)

  In objects:
this - value of itself (object)

Types

(nil type-of obj) - returns a symbol designating type of result of calculation obj, for objects returns a classname
nil - nothing (the empty list)
false - false (or lie)
true - The logic truth
cons - List cell
vector - vector (array)
string - string of characters
number - Number (only one type of numbers)
symbol - Symbol
char - character
stream - Stream of an input / output
window - really window
time - the date and time.
dir - directory processor.
bif - built-in kernel function.
lock
signal
environment
quote - '.
backquote - `.
unquote - ,.
At definition of types it is better to use logic functions:

(nil atom obj) - obj is not a list cell
(nil atom nil) → true
(nil atom false) → true
(nil atom cons) → false
(nil atom obj) → obj

(nil = {obj}) - all obj are nil
(nil = false) → false
(nil = nil) → true
(nil = true) → false

(nil <> {obj}) - none obj is not equal nil
(nil <> false) → true
(nil <> nil) → false
(nil <> true) → true

(false = {obj}) - equality false
(false = false) → true
(false = nil) → false
(false = true) → false

(false <> {obj}) - none obj is not equal false
(false <> false) → false
(false <> nil) → true
(false <> true) → true

(true = {obj}) - equality true
(true = false) → false
(true = nil) → false
(true = true) → true
(true = 12) → false

(true <> {obj}) - none obj is not equal true
(true <> false) → true
(true <> nil) → true
(true <> true) → false

(nil stringp obj) - obj is string
(nil stringp "ab") → "ab"
(nil stringp 1) → false

(nil charp x) - character
(nil charp #\t) → #\t
(nil charp true) → false

(nil listp obj) - of conformity to a list cell or nil
(nil listp nil) → true
(nil listp 1) → false
(nil listp '(1 . 2)) → (1 . 2)

(nil consp obj) - of conformity to a list cell
(nil consp 1) → false
(nil consp '(1)) → (1)

(nil vectorp obj) - of conformity to a vector
(nil vectorp #(1 2)) → #(1 2)
(nil vectorp 1) → false

(nil symbolp obj) - of conformity to a symbol

(nil numberp obj) - number

(nil streamp obj) - stream
(nil streamp notstream)→false
(nil streamp stream)→stream

(nil objectp obj) - object of a class

(nil windowp x) - conformity to a window
(nil windowp win) → win
(nil windowp 1) → false

(nil timep obj)

(nil dirp obj)

(nil bifp obj)

(nil lockp obj)

(nil signalp obj)

(nil envp obj)

(nil quotep obj)

(nil backquotep obj)

(nil unquotep obj)

Symbols

  Symbols it is auxiliary object for programming, Pure Lisp have no symbols. They can have values: usual and functional, at them is present auxiliary properties.

(symb <> s1 … sn) - any symbol si is not equal symb

(symb = symb…symb), (symb < symb…symb), (symb <= symb…symb), (symb > symb…symb), (symb >= symb…symb) - comparisons (alphabetically).

(symb min symb … symb), (symb max symb … symb) - minimal/maximal (alphabetically).

(symb + {symb|string|char}) - new symbol
(('abc + '- 'def) set 1)=('abc-def set 1)
(symb - symb … symb) new symbol
(('abcdef - 'cd) set 1)=('abef set 1)

(string|char symbol) - returns a symbol with a name string|char.

(symbol put prop val) - establishes property prop a symbol symbol with value val, returns val
Property of a symbol is only in the current space of names.
('work1 namespace
  (symbol put prop propv))
('work2 namespace
  (symbol get prop)) → NIL
(symb get prop) - property of a symbol symb with a name prop. At absence of the given property comes back NIL
At ocurrence of several spaces of names the first got property comes back.
('std namespace
  (symb put prop propv)
  …
  ('another namespace
    (symb get prop) → propv
    …))
(symb remprop prop) - deletes property of a symbol symb with a name prop. If deleted property is not present - comes back false differently true. Property deletes only in current space of names.

(symb properties) - returns all properties of a symbol as #((symb. value) …), pairs in vector are sorted on symb

(symbol boundp [env]) - whether symbol has a value. Returns true or false.

(nil|symbol gensym) - Function-generator of the different symbols beginning on symbol if the initial symbol is not specified begins on t. It is guaranteed, that the returned symbol is new.

Setting the value

(symbol set val [env]) - changes the value of the variable. If the variable has not, it is created in the current environment.
(('(x y) first) set 1)=(nil setq x 1)
(var letset val) - giving of values of a variable var in the current environment (does not touch value of a variable above). Name of a variable var is calculated. Result will be val
It is applied at lateness of definition of variables of the form let:
('x set 1)
(nil let ()
  …
  ('x letset -2)
  …)
x → 1
(nil|environment setq [{symb val}]) - changes the value of variables. If some variable has not, it is created in the current environment. The symbols symb are not calculated.
(nil setq x (10 - 1))
x → 9

(nil environment) - current environment.

(nil environment-external) - external environment.

Forms of management

(nil progn b1 … bn) - by turns calculation b1 … bn , returns result of calculation bn after calculation of all forms b1…bn.

(nil parallel task … task) - parallel calculation of task's. Comes back nil

(nil fork {body}) - creates new task (nil progn {body}), does not expect their result and returns nil.

(nil if test then else) - calculates test if this value nil or false calculates else, differently - calculation then.
(nil if) →nil
(nil if test)=(nil progn test nil)

(nil when test {work})=(nil if test (nil progn {work})) - if result of test calculation is positive, calculates by turns tasks work.

(nil let ((var1 {val1})|var1(varn {valn})|varn) {body}) - creates in parallel local links of variables var with values val and by turns calculates the form body. Variables without value val are initialized with value nil.

(nil cond (test1 [{form1}])|atom … (testn [{formn}])|atom) - by turns calculated testi while not found not false and not nil value. Returns result of last calculation of the corresponding form formi. If formi it is not specified, the result of calculation testi comes back. Providing arguments: atoms - are ignored.
(nil cond (false 1) ignore) → nil
(nil cond (false 1) (nil (cout write …))) → nil
(nil cond (false 1) (ok oking))
→ evaling oking
(nil cond (false 1) (ok)) → ok
(nil cond (false 1) (notok oking) (true default))
→ evaling default

'obj - calculation of obj is blocked.

(nil|environment eval obj) - double calculation. First obj it is calculated as argument of function eval , then returns the result of calculation by the interpreter of the received value in a corresponding environment.

(nil|environment apply obj fn arglist) - application of function fn to arguments arglist. Value of a variable fn can be a name or lambda-list. Arguments and object calculates only once.

(nil|environment funcall obj fn [{arg}]) - application of function fn to arguments arg. Value of a variable fn can be a name or lambda-list. Arguments and object calculates only once.

`obj - partial prohibition of calculations of argument obj . When inside the form obj there is a ,x - that subform x is calculated and substituted in the form obj . Also there is a ,@x - it means that value x as the list is substituted by elements in the form obj.
('l set '(1 2 . 3))
`(0 ,l ,@l)→(0 (1 2 . 3) 1 2)
,obj - insertion inside the form `.
,@obj - insertion with distribution inside the form `.
`(a ,@'(1 + 1) b c)→(a 1 + 1 b c)

(string load [arg1 … argn]) - reads out a file with a name string, calculates and returns corresponding result. Before calculation the variable arg links with the list of arguments (arg1 … argn). After calculation the previous value arg is restored.

(string save obj) - writes down object obj in a format of writing in a file with a name string.

(nil do-while {body}) - cyclic calculation of the forms body if its last result will be nil or false calculations stop and result will be this value.

(nil while test {body}) - by turns conditional cycle. It is checked test, if test=false or nil then result will be this value. Then forms are by turns carried out body, then a step to check test.

(nil try task-body {exception-name exception-body}) - running task-body. While task running an exception was occurred, the exception-body is running. The exception-name is not calculated. Name verifying makes by equality eq. If is not supplied the name of current exception, will not executed additional tasks and an exception keeped. The last name may be nil, then any exception will be work up.
(nil try (nil setq result (nil eval task)) nil (nil setq error true)) - when by interpreting task was an error, the flag error is set.
(nil throw exception) - argument calculating, exception setting.
(nil throw `(,x " is not accepted"))
(nil exception) - the current exception is returned.
(nil try (nil eval task) nil (cerr writeln "exception: " (nil exception)))
(nil exception-history) - returns the history of calulation in the exception time. Out of block try returns nil. The history is list (… (integer-number-depth-of-calulation-in-stack bool-in/out command) …). For looking may call function (stream history-show (nil exception-history)).
(nil try (nil eval task) nil (cerr writeln "exception-history: " (nil exception-history)))
(stream history-show history) - writes in stream history of calculation, defined by list (… (integer-number-depth-of-calulation-in-stack bool-in/out command) …). The history of calculation may get by function (nil exception-history).
(nil try (nil eval task) nil (cerr writeln "exception-history: ") (cerr history-show (nil exception-history)))

Logic

(nil not obj) - simply not
(nil not nil) →true
(nil not false) → true
(nil not true) → false
(nil not 1) → nil

(nil or a b … z) - calculates in parallel arguments and returns the first calculated not false and not nil value if such has not got - nil.
(nil or) → nil
(nil or nil) → nil
(nil or true) → true
(nil or false) → nil
(nil or false nil) → nil
(nil or false nil 123) → 123
(nil and [a [b … [z]]]) - calculates the arguments by parallel. If in the arguments was values false or nil returns false, otherwise true.
(nil and) → true
(nil and nil) → false
(nil and false) → false
(nil and 123) → true
(nil and 123 nil) → false
(nil and 123 nil false) → false
(nil xor a b … z) - returns a single affirmative value. If there are not caught back nil. If you came across more than one returned false.
(nil xor) → nil
(nil xor nil) → nil
(nil xor false) → nil
(nil xor 123) → 123
(nil xor false false) → nil
(nil xor false 123) → 123
(nil xor 123 234) → false
(nil xor nil 123) → 123
(nil xor false 1 false false) → 1
(nil xor false 1 false nil 2) → false
(nil eq a b) - physical equality of two objects (equality of pointers)
(nil eq) → true
(nil eq a) → (nil = a)
(nil eq nil nil) → true
(nil eq false false) → true
(nil eq 1 1) → false
(nil eq 'sym 'sym) → sym

Numbers

12 - integer.
12.3 - with fraction part.
2/3 - fraction.
1/2/3 - one integer plus two-thirds.
1/2/3e20=(1+2/(3*1020))=(1+1/(15*1019)) - with the exponential.
1+2/3i, 1/3i, -7i+1e100 - complex.

(a + b c … z) - addition a+b+c++z.
(a +) → a
(a + 1 2) → a+3
(2/3 + 1)1/2/3
(1+2i + 1+1i)2+3i
(a - b c … z) - subtraction a-b-c--z.
(a -)-a
(a - 1 2) → a-3
(2/3 - 1)-1/3
(1+2i - 1+1i)1i
(a * b … z) - multiplication.
(a *) → a
(a * 2 3) → a*6
(1+2i * 2i)-4+2i
(a / b … z) - division on all other numbers.
(a /)1/a
(a / 2 3) → a/6
(1 / 2/3)1.5
(1 / 1+2i)0.2-0.4i
(a = b … z) - equality a=b=…=z.
(2 = 2)2
(2 = 3)false

(n <> x1 … xk) - any number xi is not equal n .

(a < b … z) - numbers grow a<b<…<z.

(a > b … z) - numbers decrease a>b>…>z.

(a <= b … z) - less or equal(do not decrease) a≤b≤…≤z.

(a >= b … z) - bigger or equal(do not grow) a≥b≥…≥z.

  At successful comparison the first argument a comes back.

(x nanp) - predicate of 0/0.

(x infp) - predicate of ±∞.

(x finitep) - predicate of finite number, not ±∞ and not 0/0.

(number integerp) - integer number.
(1.5 integerp) → false
(2 integerp) → 2
(1/0 integerp) → nil
(number evenp) - predicate, on evenness.
(3 evenp) → false
(-4 evenp) → -4
(3.5 evenp) → nil

(number oddp) - predicate, on oddness.
(4 oddp) → false
(-5 oddp) → -5
(3.5 oddp) → nil

(numb min numb … numb), (numb max numb … numb) - the minimal/maximal number.

(a abs) - absolute value.
(2 abs) → 2
(-3 abs) → 3

(3+4i abs)5
(x ceil [d]) - the minimal integer, not smaller x.
(-2.5 ceil)=-2
(2.5 ceil)=3
(7 ceil 2)=((7 / 2) ceil)=4
(2 ceil)=2
(x floor [y]) - rounding off x in the smaller side up to an integer. If given y then returns the whole part from division x on y.
(-2.5 floor) =-3
(13 floor 4) =3
(-13 floor 4) =-4
(x % [y]) - the rest of division x on y.
(13 % 4) =1
(-13 % 4) =3
(13 % -4) =-3
(-13 % -4) =-1
(13.4 % 1) =0.4
(-13.4 % 1) =0.6
(2.3 %)=(2.3 % 1)=0.3
(x gcd [{xi}]) - the greatest common divider of integers, returns a positive integer.
(3 gcd)=3
(-10 gcd) =10
(12 gcd -8) =4
(32 gcd 16 3) =1
(x lcm [{xi}]) - the minimum common multiple of integers, returns a positive integer.
(3 lcm)=3
(-10 lcm) =10
(12 lcm -8) =24
(32 lcm 16 3) =96

(x sin) - sine.

(x cos) - cosine.

(x tan) - a tangent.

(x cot) - cotangent.

(x arcsin)=sin-1x

(x arccos)=cos-1x

(x arctan)=tg-1x
(x arctan y)=tg-1(x/y) ,y>0 ,x>0

(x sinh)=(ex-e-x)/2

(x cosh)=(ex+e-x)/2

(x tanh)=sinh(x)/cosh(x)

(x coth)=cosh(x)/sinh(x)

(x arsinh)=sinh-1x

(x arcosh)=cosh-1x

(x artanh)=tanh-1x

(x sqrt) - square root √x
There are two results, returned positive.
(9 sqrt) → 3
Another: -3
(8i sqrt) → 2+2i
Another: -2-2i
(x cbrt) - cube root ∛x
There are three results. If the number is not imaginary, returns are not imaginary result.
(9 cbrt) → 3
If the number is purely imaginary (real=0), returns a purely imaginary result.
(9i cbrt) → -3i

(x exp) - exponent ex

(b ^ n) - a degree bn

(x log [a])=logax - the logarithm on the basis a (by default natural logarithm).

(x ln)=ln(x) - natural logarithm.

(x lg)=log10x - the decimal logarithm.

(n string [digc]) - returns the string, which precisely represents number. Can be in a fractional form. The maximum quantity of digits digc is if necessary established.
(4/6 string) → "2/3"
(4/6 string 2) → "6.7e-1"
(4/6 string 0) → "6.66666666667e-1" ; 12 digits

(x !)=1*2*…*x - a factorial.

(nil random) - returns random floating number, in an interval [0…1).
(nil random) → 0.102355897908
(numb random) - returns random floating number, smaller on absolute value, than numb.
(pi random) → 2.0939049352352
(-3 random) → -1.194246236960
(number for symbol {body}) - in parallel local variables symbol (for each process the personal variable symbol) numbers are given 0…number-1, at each value forms are calculated by turns body.
(3 for i (cout write " i+1=" (i + 1)) (i + 1)) →
i+1=2 i+1=1 i+1=3
→ nil
(number for* symbol {body}) - by turns local variable symbol gives numbers 0…number-1, forms body are calculated by turns. Last result of the form body comes back.
(3 for* i (cout writeln "i=" i "..")) →
i=0..
i=1..
i=2..
(number setf number)=(number number number) - physically changes number with new value. Using of the given operation is fraught with mistakes of programming.
('x set 7) → 7
('y set (nil list x x x)) → (7 7 7)
(x setf (x - 1)) → 6
y → (6 6 6)
For avoidance of damage of the working program it is necessary to use function of copying:
(nil let ((x 0)) … → (nil let ((x (0 copy))) …
('x set 0) → (x setf 0)
(nil setq x 0) → (x setf 0)
(number copy) - returns new number.
('number newobject)≈(0 copy)
('number newobject number)=(number copy)
('number newobject number number)C(number number)
(number += [{x}])≈(number setf (number + [{x}]))
(number -= [{x}])≈(number setf (number - [{x}]))
(number *= [{number}])≈(number setf (number * [{number}]))
(number /= [{number}])≈(number setf (number / [{number}]))
(number degrees)=number*180/π
(number radians)=number/180*π
(n combin x)=C(x,n)=n!/x!/(n-x)!
(n combina x)=n!/(n-x)!
(nil multinomial x … z)=(x+…+z)!/x!…/z!
(number round [diff]) - returns roundoff: [number-diff … number+diff]
>(pi round 1e-3)
3/15/106
>(e round 1e-3)
2.71875
; = 2/23/32
(
x round 1)=[x]
(x round)=(x round 0.5)=[x+0.5]
(number num) - positive integer numerator of number.
(number denom) - positive integer denominator of number.

(nil number) - returns new number 0.

(number real) - real part of number. x+yi → x
(number imag) - the imaginary part of number. x+yi → y
(number conj) - conjugate of number. x+yi → x-yi
(abs polar arg) - number in trigonometric form. abs*(cos(arg)+i*sin(arg))
(number arg) - argument arg(number) number -π…π

List

(list first) - returns a first element of the list.
('(1 2 3) first)→1
(nil first)→nil
(list rest) - returns a tail part of the list.
('(1 2 3) rest) → (2 3)
(nil rest)→nil

(list second)=((list rest) first)

(list third)=(((list rest) rest) first)

(list size) - returns length of the list (count of list cells).
(nil size) → 0

(nil cons first rest) - creates a list cell with respective links.

('cons newobject first rest)=(nil cons first rest)
('cons newobject another-cons)=(another-cons copy)
('cons newobject)=(nil cons nil nil)

(list elt [{integer}]) - returns an element of the list listinteger,…. Elements of the list are numbered: 0 - first(list) 1 - second(list) … (size-1) – first(last(list)).
('((1 2) (3 4)) elt) → ((1 2) (3 4))
('((1 2) (3 4)) elt 0) → (1 2)
('((1 2) (3 4)) elt 0 1) → 2
('((1 2) (3 4)) elt 0 1 2) → nil

(nil list arg1 … argn) - returns the list of arguments (arg1 … argn), arguments are calculated in parallel

(nil list* arg1 … argn) - returns the list of arguments (arg1 … argn-1 . argn), last argument incorporates as tail, arguments are calculated in parallel
(nil list* 'a 'b '(c d e)) → (a b c d e)
(list last) - returns last list cell
('(1 2 3) last) → (3)
('(1 2 . 3) last) → (2 . 3)
(nil last) → nil
(list + [{list}]) - returns concatenation of lists list. All lists do not destroyed.
('(1 2 3) + '(4 5 6)) → (1 2 3 4 5 6)
('(1 2 3) + atom '(a) nil '(dotted . list)) → (1 2 3 a dotted . list)
(list reverse) - creates new list with the reverse place of elements. Cycled list is not supported.
('(1 2 3 . tail) reverse)→ (3 2 1)
(list cycledp) – Cycled list check. The execution time is O(n²).
(nil setq l '(1 2 3))
(l cycledp) → false
(((l rest)rest)setrest l) → (3 1 2 .. 3 1 2 ... )
(l cycledp) → (1 2 3 .. 1 2 3 ... )
(list remove elt) - deletes from the list elements satisfying to equality (elt = listi), returns the new list without the given elements
('(1 2 3) remove 2) → (1 3)
(list substitute old new) - replacement of elements old on new (at comparison the method = is used). Returns the new list.
('(a x x a) substitute 'x 'b) → (a b b a)

(cons copy) - one link of list copy.

(list copy-list) - returns the new list. Cells of top level are copied only. A copying of the looped lists is not supported. The execution time is O(n).

(list copy-list-protected) - returns the new list. Cells of top level are copied only. A copying of the looped lists is supported. The execution time is O(n²).

(list copy-tree) - returns a new tree. Cells, both first and rest are copied all.

(cons setfirst newfirst) - replaces a head part of the list cons with object newfirst
(list setrest newrest) - replaces a tail part of the list list with object newrest. If list an element of your program it is necessary to know, that these procedures change the program and it is hard to present as she then looks. That you did not have mistakes use in the program not (nil let ((l '(nil progn ) … but (nil let ((l (list nil 'progn)…
(cons cons first rest)=(cons setfirst first),(cons setrest rest)
(cons cons another-cons)=(cons setf another-cons)
(consthis setf consarg)=(consthis setfirst(consarg first)),(consthis setrest(consarg rest)) - replaces parts of a cell on new, given consarg. Use of the given operation is fraught with mistakes of programming.
(list += [{list}]) - all lists unites, destroys their structure, except for the last. Returns the united list. The looped lists is not supported.
('list1 set '(a b . c))
('list2 set '(c d . e))
('list3 set '(e f . g))
(list1 += list2 list3)
list1 → (a b c d e f . g)
list2 → (c d e f . g)
list3 → (e f . g)
(list for* symbol {body}) - by turns local variable symbol gives elements of the list list , forms body are calculated by turns. Last result of the form body comes back.
('(1 2 3) for* i (cout writeln "i=" i "..")) →
i=1..
i=2..
i=3..
(list for symbol {body}) - to in parallel local variables symbol (for each process the variable symbol) elements of the list are given, at each value forms body are calculated by turns. The looped lists is not supported.
('(1 2 x) for i (nil if (nil not (nil numberp i)) (cout writeln i " is not number"))) →
x is not number
nil

(list assoc who [testeql]) - returns a pair (obj . obj-value) from a list ((a . 1) (b . 2) … (c . 3)) at which who=obj if this pair there exists, and nil - at absence of value. By search predicates of equality of objects testeql, by default are used: =

(list rassoc who [testeql]) - returns a pair (obj . obj-value) from a list ((a . 1) (b . 2) … (c . 3)) at which who=obj-value if this pair there exists, and nil - at absence of value. By search predicates of equality of objects testeql, by default are used: =
('((1 . a) (2 . b) (3 . c)) rassoc 'c)→ (3 . c)

(nil acons x y a-list)=(nil cons (nil cons x y) a-list) - adds in the associative list a pair (x . y), the result should be saved: ('a-list set (nil acons x y a-list))

(a-list pairlist keys-list data-list) - returns the associative list from the list of keys and the list of data, and also adds old a-list.
('((a . 1)) pairlist '(b c) '(2 3)) → ((b . 2) (c . 3) (a . 1))

(list = list … list) - comparisons of the contents of all lists

(list <> l1 … ln) - any list li is not equal list.

(list contain item [test]) - whether is item in list, by default test is =
('(a b c d) contain 'c) → (c d)

(list vector) - returns a new vector with elements of the list

(nil vector) - returns a new empty vector #()

(list map fn [{list}]) - application of function fn to elements of list and elements of [{list}]. Value of a variable fn can be a name or lambda-list. The list of result is returned. Calculations executed in parallel.
('(1 2 3 4) map '- '(1 1 1 1)) → '(0 1 2 3)
('(1 2 3 4) map '-) → (-1 -2 -3 -4)
('(1 2.3 x "4") map '(lambda () (nil numberp this))) → (1 2.3 false false)
(list mapc fn [{list}]) - application of function fn to elements of list and elements of [{list}]. Value of a variable fn can be a name or lambda-list. Does not return value. It is used for side effect obtaining. Calculations executed in parallel.

(list count [{x}]) - quantity of units of the list satisfying to inquiry (elt = [{x}]).

(list count-if fn [{x}]) - quantity of units of the list satisfying to inquiry (elt fn [{x}]).

(list find [{x}]) - the list cell containing a unit satisfying condition (elt = [{x}]) comes back.
('(1 2 3) find 2) → (2 3)
('(1 2 3) find 4) → nil
(list find-if fn [{x}]) - the list cell containing a unit satisfying condition (elt fn [{x}]) comes back.
('(1 2 3) find-if 'evenp) → (2 3)
('(1 2 3) find-if '> 10) → nil
(list replace old new) - substitutes list units satisfying to a condition (elt = old) on new value new.
(list replace-if fn new) - substitutes list units satisfying to a condition (elt fn) on new value new.

Vector

(vector elt [i [j … [k]]]) - returns an element of vectori,j,…,k. Elements of vector are numbered from 0 up to size-1.

(vector size) - returns length of the vector
(#() size)→0
(#(1) size)→1
(vector resize size [new]) - corrects vectors length in the size , if it is necessary to add the size, additional elements are initialized new
(vector clear)=(vector resize 0)
(vector setelt i j … k new) - establishes new value on indexes i,j,…,k on new. Returns corrected vector
(#(1 #(2 3) 4) setelt 1 1 'new) → #(1 #(2 new) 4)
(vector reverse) - creates new vector with the reverse place of elements
(#(1 2 3) reverse)→ #(3 2 1)
('vector newobject dimlist [init]) - creates a vector of dimension dimlist1×dimlist2×…×dimlistn with elements init.
('vector newobject '(2 2) 0) → #(#(0 0) #(0 0))
('vector newobject number [init]) - creates unidimensional vector of dimension number with elements init.
('vector newobject 2 0) → #(0 0)
('vector newobject another-vector)=(another-vector copy)
('vector newobject another-vector integer-index-start)
('vector newobject another-vector integer-index-start integer-size)
('vector newobject) → #()
(vector merge {vector}) - returns association of vectors. All vectors do not collapse
(#(1 2) merge #() #(3 4)) → #(1 2 3 4)
(vector part a [n]) - returns a new vector with length n with elements on indexes from a'th. If the parameter n - is not set, copying occurs up to the end.
(#(1 2 3 4) part 1 2) → #(2 3)
(#(1 2 3 4) part 1) → #(2 3 4)
(vector push item) - item it is added in vector, vector comes back
(vector push item n) - item is added n time in vector, comes back vector
('x set #(1 2))(x push 3)→#(1 2 3)
x=#(1 2 3)
('x set #(1 2))(x push 3 2)→#(1 2 3 3)
x=#(1 2 3 3)
(vector pop) - deletes from vector last element and returns it.
('y set #(1))
(y push 2) → #(1 2)
(y pop) → 2
y → #(1)
(vector contain item [test]) - whether is item in vector, by default test is =
(#(a b c d) contain 'c) → 2
(#(a b c d) contain 'e) → false
(vector for* symbol {body}) - by turns local variable symbol gives elements of vector, forms body are calculated by turns. Last result of the form body comes back.
(#(1 2 3) for* i (cout writeln "i=" i "..")) →
i=1..
i=2..
i=3..
(vector for symbol {body}) to in parallel local variables symbol (for each process the variable symbol ) elements of vector are given, at each value forms body are calculated by turns.
(#(1 2 3) for i (cout write " i+1=" (i + 1)) (i + 1)) →
i+1=3 i+1=2 i+1=4
→ nil

(vector copy) - returns a new vector.

(vector copy-matrix) - returns a new vector. If a unit - a vector it also is copied.

(vectorthis setf vectorarg) - full replacement of elements of a vector on new, given vectorarg.

(vector vector dimlist [init])≈(vector setf ('vector newobject dimlist [init]))
(vector vector number [init])≈(vector setf ('vector newobject number [init]))
(vector vector another-vector)=(vector setf another-vector)

(vector vector another-vector integer-index-start) - assign elements from starting index.
(#() vector #(1 2 3) 1) → #(2 3)
(vector vector another-vector integer-index-start integer-size) - assign elements from starting index, with given new size.
(#() vector #(1 2 3) 1 1) → #(2)

(matrix transpose) - returns a new matrix with the rearranged elements
(#(#(1 2) #(3 4)) transpose) → #(#(1 3) #(2 4))
(vector + {vector}) - addition of vectors of numbers, matrixes and other objects which has method +.
(#(1 2) + #(3 -4)) → #(4 -2)
(#(#(1 2) #(3 4)) + #(#(1 0) #(0 -1))) → #(#(2 2) #(3 3))
(vector - {vector}) - subtraction of vectors of numbers, matrixes and other objects which has method -. Returns new vector.
(#(1 2) - #(3 -4)) → #(-2 6)
(#(1 2) -) → #(-1 -2)
(#(#(1 2) #(3 4)) - #(#(1 0) #(0 -1))) → #(#(0 2) #(3 5))
(vector * number … ) - multiplication of elements of a vector to number , returns a new vector.
(vector * vector) - scalar multiplication.
(#(1 -2) * 2 -3) → #(-6 12)
(#(1 2) * #(-2 1)) → 0

  The vector of vectors means a matrix. The matrix is set by lines. The first element of a vector is the first line of the matrix, the second - the second, etc. Operations + , - , * are set in mathematical sense.

R=M+N Ri,j=Mi,j+Ni,j
R=M-N Ri,j=Mi,j-Ni,j
R=m*N Ri,j=m*Ni,j

(vector remove elt) - deletes from the vector elements satisfying to equality (elt = vectori), returns the new vector without the given elements
(#(1 2 3) remove 2) → #(1 3)
(vector = v1 … vn) - equality vector=v1=…=vn
Elements of a vector should have a method <>.
(vector <> obj1 … objn) - any argument obji is not equal vector.
Elements of a vector should have a method <>.
(vector list) - returns the new list of elements of a vector
(#(1 2) list) → (1 2)
(vector empty) - predicate of an empty vector
(#(1 2) empty) → false
(#() empty) → #()
(vector insert integer-place x) - insert x in a integer-place.
(#(1 2) insert 1 7) → #(1 7 2)
(vector += [{vector}])≈(vector setf (vector + [{vector}]))
(vector -= [{vector}])≈(vector setf (vector - [{vector}]))
(vector *= [{number}])≈(vector setf (vector * [{number}]))
(vector swap integer-index integer-index) - interchanges the position elements of a vector. Returns a vector.
(vector first)=(vector elt 0)
(vector last)=(vector elt ((vector size) - 1))
(vector map fn [{vector}]) - application of function fn to elements of vector and elements of [{vector}]. Value of a variable fn can be a name or lambda-list. The vector of result is returned. Calculations executed in parallel.
(#(1 2 3 4) map '- #(1 1 1 1)) → #(0 1 2 3)
(#(1 2 3 4) map '-) → #(-1 -2 -3 -4)
(#(1 2.3 x "4") map '(lambda () (nil numberp this))) → #(1 2.3 false false)
(vector mapc fn [{vector}]) - application of function fn to elements of vector and elements of [{vector}]. Value of a variable fn can be a name or lambda-list. Does not return value. It is used for side effect obtaining. Calculations executed in parallel.

(vector count [{x}]) - quantity of units of a vector satisfying to inquiry (elt = [{x}]).

(vector count-if fn [{x}]) - quantity of units of a vector satisfying to inquiry (elt fn [{x}]).

(vector find [{x}]) - the index of a unit of a vector satisfying to a condition (elt = [{x}]) comes back.
(#(1 2 3) find 2) → 1
(#(1 2 3) find 4) → nil
(vector find-if fn [{x}]) - the index of a unit of a vector satisfying to a condition (elt fn [{x}]) comes back.
(#(1 2 3) find-if 'evenp) → 1
(#(1 2 3) find-if '> 10) → nil
(vector replace old new) - substitutes vector units satisfying to a condition (elt = old) on new value new.
(vector replace-if fn new) - substitutes vector units satisfying to a condition (elt fn) on new value new.
(vector sort) - sorting of units of a vector (order method <).
(#(1 2 3 4 3 2 1) sort) → #(1 1 2 2 3 3 4)

Strings

(str size) - returns length of a string

('string newobject number [char]) - creates a string of the given size. It is filled by letters char, by default blanks.
('string newobject another-string)=(another-string copy)
('string newobject) → ""

(str1 + {strn|char}) - returns association of strings str… all the strings do not collapse
('x set "Year") ("New" + " " x #\!)→ "New Year!"

(str0 = str1 … strn) equality str0=str1=…=strn

(str <> st1 … stk) - any string sti is not equal str

(str0 < str1 … strn), (str0 > str1 … strn), (str0 <= str1 … strn), (str0 >= str1 … strn) - on a code of characters (alphabet order).

(str min str … str), (str max str … str) - minimal/maximal

(obj string) - creates a line which represents line performance of object obj. Transformation of types is supported: nil, false, true, char, number, symbol.
(('(1) rest) string) → "NIL"
((2 / 4) string) → "0.5"
('abcd string) → "abcd"
(str elt ind) - the character on a place ind.
If ind exceeds the size of a string comes back nil.
(str setelt ind newchar) - puts other character newchar on a place ind. Returns the corrected string str.
If ind exceeds the size of a string the string increases the size with addition of spaces.
(str part ind [n]) - creates new string with length n with letters by indexes beginning from ind. If the parameter n - is not set, copying occurs up to the end.
("abcd" part 1 2) → "bc"
("abcd" part 1) → "bcd"

(str lower) returns a new string with letters in the bottom register

(str upper) returns a new string with letters in the top register

(str read) - converts a line in Lisp object (the built - in parser)

(string for* symbol {body}) - by turns local variable symbol gives elements string string , forms body are calculated by turns. Last result of the form body comes back.
("(1 2 3)" for* i (cout writeln "i=" i "..")) →
i=(..
i=1..
i= ..
i=2..
i= ..
i=3..
i=)..
(string for symbol {body}) to in parallel local variables symbol (for each process the variable symbol ) elements string string are given, at each value forms body are calculated by turns.
("abc" for i (cout write " code(i)=" (i code)) (i code)) →
code(i)=99 code(i)=98 code(i)=97
→ nil
(string contain char [test]) - whether is char in string, by default test is =
("abcd" contain #\c) → 2
("abcd" contain #\e) → false
(string list) - returns the list of characters.
("Abcd" list) → (#\A #\b #\c #\d)
(string vector) - returns the vector of characters.
("Abcd" vector) → #(#\A #\b #\c #\d)
(string remove elt) - deletes from the string elements satisfying to equality (elt = stringi), returns the new string without the given elements
("ABBA" remove #\B) → "AA"

(string copy) - returns new string.

(string setf string) - physically replaces a string with new value. Use of the given operation is fraught with mistakes of programming.
('x set "abc") → "abc"
('y set (nil list x x x)) → ("abc" "abc" "abc")
(x setf (x upper)) → "ABC"
y → ("ABC" "ABC" "ABC")
For avoidance of damage of the working program it is necessary to use function of copying:
(nil let ((x "")) … → (nil let ((x ("" copy))) …
('x set "abc") → (x setf "abc")
(nil setq x "abc") → (x setf "abc")

(string string number [char])≈(string setf ('string newobject number [char]))
(string string another-string)=(string setf another-string)

(string resize newsize [char]) - resize string to newsize. New characters are defined by char. By default is space.
(string += [{char|string}])≈(string setf (string + [{char|string}]))
(string replace index size char|string) - substitutes a site of string since index on index+size-1 on new string or the character.
("aha" replace 1 1 "bb") → "abba"
(string replace char char) - substitutes characters.
("aha" replace #\a #\A) → "AhA"
(string replace-if method char) - substitutes characters operations of a method satisfying to result method on new value char.
("10x15" replace-if '(lambda()(nil not (this digitp))) #\space) → "10 15"

(string count [{x}]) - quantity of units of string satisfying to inquiry (elt = [{x}]).

(string count-if fn [{x}]) - quantity of units of string satisfying to inquiry (elt fn [{x}]).

(string find [{x}]) - the index of a unit of string satisfying to a condition (elt = [{x}]) comes back.
("abcE" find #\E) → 3
("abcE" find #\e) → nil
(string find-if fn [{x}]) - the index of a unit of string satisfying to a condition (elt fn [{x}]) comes back.
("abcE" find-if 'upperp) → 3
("abcE" find-if 'digitp) → nil

Characters

(char0 = char1 … charn) equality char0=char1=…=charn

(char <> char1 … charn) - any chari is not equal char

(char0 <= char1 … charn) char0≤char1≤…≤charn

(char0 < char1 … charn) char0<char1<…<charn

(char0 > char1 … charn) char0>char1>…>charn

(char0 >= char1 … charn) char0≥char1≥…≥charn

(char min char … char), (char max char … char) - minimal / maximal

(number char) - returns a character with a code number

(ch code) - returns a code of a character ch

(ch alphap) - the letter in the top or bottom register #\a…#\z #\A…#\Z

(ch upperp) - the letter in the top register #\A…#\Z

(ch lowerp) - the letter in the bottom register #\a…#\z

(ch digitp) - #\0…#\9

(ch spacep) - character-divider

(ch controlp) - managing character (ASCII 0…31 or 127)

(ch printp) - whether it is possible to print out

(ch upper) - equivalent of the letter in the top register

(ch lower) - equivalent of the letter in the bottom register

(charthis setf chararg)=(charthis char chararg) - changes value of the letter on new, given chararg. Use of the given operation is fraught with mistakes of programming.
(char copy) - returns new character.
('char newobject char)
('char newobject) - the new space character.

Locks and signals

  It is used for exclusive access to the important sites of the program.

('lock newobject) - creates the lock.

(lock progn {body}) - the lock is put and by turns calculates tasks body. If the lock has been closed, its opening is expected.

(lock try task-locked task-free) - at successful installation of the lock the task-locked is calculated, differently task-free is calculated.

(lock set) - the lock is put. If the lock has been closed, its opening is expected. It is not recommended to use. The big danger of errors at programming.

(lock free) - the lock opening. It is not recommended to use. The big danger of errors at programming.

('signal newobject) - creates the object a signal.

(signal wait [lock]) - the signal waiting. If the lock is given then it is disabled and at signal reception is installed.
(lock progn
  …
  (signal wait lock)
  …)

(signal send) - dispatches a signal.

Object-oriented programming

  This technics of programming that is created that people could understand very big program physically. And the part of a code which has some functions of dialogue with other part of the program is called as object.
  All built-in types have the class, it is possible to find out its name with the help of function (nil type-of obj).

(classname defclass) - minimal yet empty definition. Returns classname.

(classname defclass pclass1 … pclassn) - definition of a class with parental classes pclass1… pclassn
The overload of methods/static variables occurs from left to right:
Methods from pclassn overload pclassn-1 ,… methods of the given class overload all others.

(classname defvar [{varname}]) - adds a fields to a class. Symbols varname - are not calculated. Returns classname.
External access up to variables of object no. It is possible only with the help of methods.

(classname setstatic varname startvalue) - adds/change a static field of a class. All arguments are calculated.

(classname defmethod methodname (… args …) {methodbody}) - adds a method to a class. Tasks methodbody will be calculated by turns.

As against the majority of languages, it is possible to dynamically change methods during evaluation of the program - and all existing objects will change accordingly their "behaviour".

(classname defmacro macroname (… args …) {macrobody}) - adds a macro to a class.

  To define the closed function for work in object it is possible by means of the static variables defined as the lambda-list.
('className setstatic 'functionName '(lambda ( … arguments … ) function-body))
  To start such function it is necessary to use funcall:
(nil funcall this functionName … arguments … )

(classname getmethod methodname) - returns definition of a method. methodname is calculated. If such method is not present, nil.

(classname getstatic staticname) - returns static field value of a given class. staticname is calculated.

(classname getclass) - returns definition of a class. If such class is not present, nil.

Using:
(obj) → obj
(obj method arg1 … argn) - call of a method of object obj.

(classname newobject {args}) - creates new object of the given class.
If has been created the method with a classname this constructor with arguments {args} is started.

(object copy) - returns new object.

Work with streams of an input/output

  There are three standard streams which are used by functions by default. They are stored in variables cin, cout and cerr.

(stream write obj … obj) - prints value of obj in convenient kind for viewing the person. Returns stream.

(stream princ obj … obj) - prints values obj as, suitable for input in the interpreter. Returns stream.

(stream writeln obj … obj) - calls function write and terminates a line. Returns stream.

(stream print obj … obj) - calls function princ and terminates a line. Returns stream.

(string open [{mode}]) - opens a file with a name string and returns the stream connected with it. The mode of a stream is set by means of symbols mode . By default it is considered on reading.
The mode can be set by symbols:
inon reading
outon writing
truncto cut down a file till zero length
appaddition in the end
ateopening and search of the end of a file

(string create)=(string open 'out 'trunc) - creates a new empty file with a name string and returns the stream connected with it for writing.

(stream close) - closes a stream.

(stream read) - reads from a stream string representation of object and returns Lisp2D object.

(stream read-line [string]) - reads a line of characters from a stream and returns a string without a character of a line termination. If the string is given result is placed there.
(cin read-line) - from the console

(stream read-char [char]) - reads 1 symbol from a stream. If it will be given char result it is placed there.

(stream read-byte [number]) - reads 1 byte from a stream and returns an integer. If the number is given result is placed there.

(stream listen) - returns true when in a stream not found out the symbol of the end of a file, else - false

(stream openp) - returns stream when stream is open, else - false.

(stream terpri) - writes a symbol of the end of a line to a stream stream

(stream write-byte integer) - writes to a stream 1 byte

(stream tellr) - returns an integer - a position of reading of a stream

(stream tellw) - returns an integer - a position of writing in a stream
  Different names of functions are necessary for job with streams of reading+writing

(stream seekr number [mode]) - establishes a position of reading of a stream

(stream seekw number [mode]) - establishes a position of writing in a stream
The first byte has a position 0 , last size-1

The symbol mode sets a mode of readout of a position:
begfrom the beginning of a current file
curfrom a current position
endfrom the end of a current file

(stream flush) - clears the buffer of a stream.

Windows

(nil window width height) - creates a window with width and height. Returns object for job with a window.
(window window [width height]) – in the provision of size creates a window of width and height. Returns the window.

(win close) - closes a window

  Coordinates are defined from left to right and from top to down.

(nil mapwindow width height) - creates a window without monitoring in display.

(window-mapped open) - show the window on display. Returns window or false.

(window openp) - is it open.

(window hide) - close the window. The image is keeped.

  The drawing of the image with the closed window is much faster.

(win rename string) - gives a title to window.

(win move x y) transfers a window to coordinate (x y)

(win resize w h) changes the sizes of a window and a matrix of colors

(nil display-size) returns the sizes of the display in pixels as the list of numbers (width height)
(nil display-size) → (1280 1024)
(nil display-sizemm) returns the sizes of the display in millimetres as the list of numbers (width height)
(nil display-sizemm) → (342 271)

(win width) - width of a window in pixels

(win height) - height of a window in pixels

(window listen) - interrogates a stream of pressing buttons of the keyboard at job in a window window . Returns a code of the letter or false . From turn of pressing it is not taken.

(window read-char [char]) - takes the letter from a stream of pressing buttons of the keyboard. If the queue is empty then expects. Returns the letter. If it will be given char result it is placed there.

(window read-keyb [number]) - returns number, a code of the pressed key on the keyboard. If the queue is empty then expects. If the number is given result is placed there.
There are global variables with a code of the basic keys:
xk-enter, xk-home, xk-end, xk-left, xk-right, xk-up, xk-down, xk-page-up, xk-page-down, xk-insert, xk-delete, xk-caps-lock, xk-shift-l, xk-shift-r, xk-control-l, xk-control-r, xk-alt-l, xk-alt-r, xk-f1, xk-f2, xk-f3, xk-f4, xk-f5, xk-f6, xk-f7, xk-f8, xk-f9, xk-f10, xk-f11, xk-f12, xk-backspace, xk-undo, xk-num-lock, xk-kp-multiply, xk-space, xk-numbersign, xk-question

(window keyb-event) - interrogates a signal of the keyboard on pressing/(pressing out) of keys of the keyboard. Returns nil or (code true|false).

(window pointer-coord) - returns local coordinates of the pointer as the list (x y).

(window button-event) - returns event of pressing buttons of the pointer as the list (buttons-number true|false x y) | NIL.
Buttons-number is the number 1…6. true|false - pressing/unpressing. x,y - coordinate of the pointer at this event. At absence of event comes back NIL

(win getpixel x y) returns color of a point as (r g b), at coordinates outside a window returns (0 0 0)

(win draw-pixel col|(colr colg colb) x y x y … x y) - Draws points on the screen the set color [0…1] If color puts number will be a grey shade, differently ([0…1] [0…1] [0…1])=(red green blue)
  At coordinate x the whole part undertakes only, are from 0 up to width-1
  At coordinate y the whole part undertakes only, are from 0 up to height-1
  Such sense of coordinates only for working with pixels.

  At functions of a portrayal not for job with pixels of coordinate in a window it is numbers from a floating point from 0 up to width (height) . Start of functions of a portrayal at coordinates behind these limits does not result in a mistake and is ignored.

(win draw-square col|(colr colg colb) x y w h … x y w h) Draws the painted over rectangulars the set color [0…1] If color puts number will be a grey shade, otherwise ([0…1] [0…1] [0…1])=(red green blue)
  By initial corner it is designated x y , width and height w h.
  Coordinates for a portrayal in a window are set by numbers from a floating point from 0 up to width (height) . To paint over all window in one color it is possible to make it so:
  (win draw-square col 0 0 w h).
  To draw lines on edge of a window it is possible to use:
   (win draw-square col 0 0 1 h 0 0 h 1 0 h w -1 w 0 -1 h)
  To draw one point:
   (win draw-square col x y 1 1)
  If coordinates not the whole function draw-square smooths the image. Therefore it is possible to trace many small rectangulars and it gives effect to a half-transparency.

(nil let ((size 200) halfsize shift w (map 10) size/map)
  (nil setq
    halfsize (size / 2)
    shift (size / 20)
    size/map (size / map)
    w (nil window (size + 1) (size + 1)))
  ((map + 1) for i
    (w draw-square '(0 1 1)
      0 (i * size/map) (size + 1) 1
      (i * size/map) 0 1 (size + 1)))
  (halfsize for i
    (w draw-square '(1 0 0)
      (i - shift) (i + shift) halfsize (i / halfsize)))
  (halfsize for i
    (w draw-square '(0 0 1)
      (i + shift) (i - shift) (i / halfsize) halfsize))
  (cout write "press a key...")
  (w read-keyb)
  (w close))

(win draw-line col|(colr colg colb) radius x y x y … x y) - draws lines on the screen the set color [0…1] If color puts number will be a grey shade, differently ([0…1] [0…1] [0…1])=(red green blue). radius - sets thickness of a line, more precisely radius.

Space of names

  It is intended for easing an overload of names of functions and constants.
It is recommended to define functions and variables in personal space as if to use other programs and they will redefine function with the same name - that access up to it is impossible.

('name namespace {body}) - connects all constants and functions determined in the given space of names and the body body is carried out by turns.
  To define these constants very simply:
('version1 namespace
  ('conste letset 1000)
  (nil defmethod m (x)
    (cout write "x=" x)))
('version1 namespace
  (nil m conste))

  From the outside this space it is impossible to use them:
conste → error
(nil m 1) → error

Almost all functions of language are determined in space of names std and it is possible to cause these functions with the overloaded definition by other programs so:
('another namespace
  ('number defmethod ! () (cout write "another"))
  …
  ('std namespace
    (3 !) → 6
    …)
  …)

Date and time

(nil daylightp) - time of time zone should be corrected with use summertime
(nil daylightp) → TRUE

(nil setdaylightp flag) - installation of a flag of that time of time zone should be corrected with use summertime

(nil timezone) - displacement of time zone in seconds
((nil timezone) / 60 60) → -2

(nil settimezone sec) - installation displacement of time zone in seconds

(nil tzname) - the strings describing time zone
(nil tzname) → ("EET" "EEST")

(nil settzname string string) - installation of the strings describing time zone

(nil time {form}) - calculates by turns the forms form and returns time of calculations in seconds.
(nil time 1) → 0.00088
(nil localtime) - returns object of class time.
(nil localtime) → Time(2008 4 19 17 51 28.0957 6 109 true)

  The class of objects time which have methods is defined.

(time year)
(time setyear integer)
(time month) → 1…12
(time setmonth integer)
(time day) → 1…31
(time setday integer)
(time hour) → 0…23
(time sethour integer)
(time minutes) → 0…59
(time setminutes integer)
(time seconds) → 0…59.999999
(time setseconds number)
(time weekday) → 0…6
0 = sunday
(time yearday) → 0…365
(time dstp) - daylight saving time. Returns true|false|nil.
(time number) - time in seconds past since January, 1, 1970 on UTC (Greenwich). It is used for synchronization on time.
(time string)
((nil localtime)string) → "Sun Apr 20 19:43:08 2008"
(nil uptime) - time in the seconds, past from the moment of loading system
(nil uptime) → 8301
('time newobject) → Time(1970 1 1 3 0 0 4 0 false)
('time newobject time)=(time copy)
('time newobject number) - installation of time, proceeding from a zero point: on January, 1st 1970. UTC (Greenwich)
(time time time)=(time setf time)
(time time number) - installation of time, proceeding from a zero point: on January, 1st 1970. UTC (Greenwich)
(time setf time)

Directory

  To work with directories there is a class dir.

('dir newobject)=('dir newobject ".")
('dir newobject dir)=(dir copy)
('dir newobject string-path)
(dir dir dir)=(dir setf dir)
(dir dir string-path)=(dir open string-path)

(dir open string-path) - opening of the directory.

(dir openp) - is it opened or not.

(dir close) - directory closing.

(dir read) - returns a string or nil(if files have ended).

  The program to print contents of the current directory:
(nil let (s (d ('dir newobject)))
  (nil do-while
    (nil if ('s set (d read))
      (cout writeln s))))

(dir rewind) - cross to the beginning of the directory.

(dir seek integer-loc) - cross to a demanded place.
integer-loc - is NOT a serial number of an element of the directory.
(dir tell) - to receive a current position in the directory.
The position is NOT a serial number of an element of the directory.
(string chdir) - makes current the given catalogue.
(nil getcwd) → "/home/alex/lisp2d"
(".." chdir) → "/home/alex"

(string rmdir) - deletes the empty catalogue.

(nil getcwd) - string, name of the current catalogue.
(nil getcwd) → "/home/alex/lisp2d"
(string-name mkdir [integer-mode]) - creates catalogue with access right (0x000-0x1ff). By deafault full access.
mode=owner(3bits) group(3bits) other(3bits)=rwxrwxrwx

System functions

(string-filename system [{string-argument}]) - gives a task to operational system. Returns task terminate code: 0…255 or nil.
("ls" system "--help") - task for console.
("mc" system) - starts the program.
(string getenv) - variable of environment
("USER" getenv) → "alex"
("USEr" getenv) → NIL
("HOME" getenv) → "/home/alex"
(string setenv string) - establishes a variable of environment
("ABC" setenv "DEF")
("ABC" getenv) → "DEF"

(string unsetenv) - reset of value of the variable environment

(nil geteuid) - number, of the identifier of the user

(nil getegid) - number, of the identifier of group
The user root has number of the identifier 0

(nil getuid) - number, of the real identifier of the user

(nil getgid) - number, of the real identifier of group
The user root has number of the identifier 0

(nil sysname) - string, name of operational system, for example "Linux"

(nil release) - string, the version of a kernel of operational system
(nil release) → "2.6.8.1-12mdk"
(nil version) - string, updating of a kernel of operational system
(nil version) → "#1 Fri Oct 1 12:53:41 CEST 2004"
(nil machine) - string, the platform on which works system
(nil machine) → "i686"
(nil nodename) - string, name of a computer
(nil nodename) → "localhost"
(nil totalram) - total amount of operative memory in bytes
((nil totalram) / 0x400) → 256376
(nil freeram) - free volume of operative memory in bytes
((nil freeram) / 0x400) → 61812
(string accessf) - check of access or existence of a file
("Makefile" accessf) → "Makefile"
("MakeFile" accessf) → FALSE
(string accessx) - check of executable of the file
("lisp2d" accessx) → "lisp2d"
("lisp2d.cpp" accessx) → FALSE
(string accessr) - check of access on reading of a file
("lisp2d" accessr) → "lisp2d"
("lisp2dd" accessr) → FALSE
(string accessw) - check of access on writing in a file
("lisp2d" accessw) → "lisp2d"
("lisp2dd" accessw) → FALSE
(string totalsize) - the size of a file in bytes
("lisp2d" totalsize) → 354410
("lisp2dd" totalsize) → 0
(string uid) - number, the identifier of the user of a file
("lisp2d" uid) → 1001
("lisp2dd" uid) → 0
(string gid) - number, the identifier of group of a file
("lisp2d" gid) → 100
(string-filename setuid number) - install the identifier of the user of a file.
(string-filename setgid number) - install the identifier of group of a file.
(string-filename setluid number) - install the identifier of the user of the reference, instead of the reference object.
(string-filename setlgid number) - install the identifier of group of the reference, instead of the reference object.
(string device) - number, the identifier of the device of file system
("lisp2d" device) → 2056
(string rdevice) - number, the identifier of the device (for special file).
("lisp2d" rdevice) → 0
(string inode) - number of index unit.
("lisp2d" inode) → 1714521
(string links) - number, quantity of rigid references.
("lisp2d" links) → 1
(string-filename accesstime) - time of last reference. Returns object of class time.
(string-filename modifytime) - time of last change. Returns object of class time.
(string-filename changetime) - time of last change of index unit. Returns object of class time.
(string-filename settime [time-access [time-modify]]) - install access time and time of change of a file. In the absence of arguments current time is installed.

(string-oldpath link string-newpath) - creation of the rigid reference to a file, not being the catalogue.

(string-oldpath symlink string-newpath) - creates symbolic link.

(string-path readlink) - returns a string of a contents of the symbolic link.

(string unlink) - deletes a file/removes membership in the catalogue

(string rename string) - changes a name or a position of the file/catalogue
("readme" rename "doc/readme") → "doc/readme"
(string ls) - reading of contents of the catalogue, returns the list of names.
("." ls) → ("." ".." "tmp" ".desktop" "work.cpp" …)
(".." ls) → ("." ".." "alex")

(nil nprocs) - number, quantity of processors of system

(string truncate size) - changes the size of a file with a name string. At unsuccessful change comes back nil.

(number seteuid) - establishes the working identifier of the user. Returns success: true or false.

(number setuid) - establishes the real identifier of the user. Returns success: true or false. Works only from the rights of the superuser.
(1002 setuid) → false

(number setegid) - establishes the working identifier of group. Returns success: true or false.

(number setgid) - establishes the real identifier of group. Returns success: true or false. Works only from the rights of the superuser.
(1002 setgid) → false
(string blocksize) - the optimal size of the block for operations of input-output. At failure comes back nil.
("." blocksize) → 4096
(string vfsblocksize) - the optimal size of the block for operations of input-output. At failure comes back nil.
("." vfsblocksize) → 4096
(string frsize) - the fundamental size of the block. At failure comes back nil.
("." frsize) → 4096
(string blocks) - the general number of blocks with 512 bytes. At failure comes back nil.
("." blocks) → 16
(string vfsblocks) - the general number of blocks. At failure comes back nil.
("." vfsblocks) → 4046090
(string bfree) - quantity of free blocks for the superuser. At failure comes back nil.
("." bfree) → 3308030
(string bavail) - quantity of free blocks for the ordinary user. At failure comes back nil.
("." bavail) → 3102499
(string files) - total of index units. At failure comes back nil.
("." files) → 2056320
(string ffree) - quantity of free index units for the superuser. At failure comes back nil.
("." ffree) → 2036930
(string favail) - quantity of free index units for the ordinary user. At failure comes back nil.
("." favail) → 2036930
(string fsid) - the identifier of file system. At failure comes back nil.
("." fsid) → 1218234540
(string rdonly) - flag only for reading: true or false. At failure comes back nil.
("." rdonly) → FALSE
(string nosuid) - the opportunity setuid/setgid is disconnected: true or false. At failure comes back nil.
("." nosuid) → FALSE
(string namemax) - the maximal length of a name of a file. At failure comes back nil.
("." namemax) → 255

(string blkp) - is a special file of the block device.

(string chrp) - is a special file of the symbolical device.

(string dirp) - is the catalogue.

(string fifop) - is the called or not called channel.

(string lnkp) - is the symbolical reference.

(string regp) - is a usual file.

(string sockp) - is a socket.

(string usrreadp)

(string setusrreadp flag)

(string usrwritep)

(string setusrwritep flag)

(string usrexecp)

(string setusrexecp flag)

(string grpreadp)

(string setgrpreadp flag)

(string grpwritep)

(string setgrpwritep flag)

(string grpexecp)

(string setgrpexecp flag)

(string othreadp)

(string setothreadp flag)

(string othwritep)

(string setothwritep flag)

(string othexecp)

(string setothexecp flag)

(string uidp) - the right to change of the identifier of the user at execution.

(string setuidp flag)

(string gidp) - the right to change of the identifier of group at execution.

(string setgidp flag)

(string vtxp) - the limited mode of removal from the catalogue.

(string setvtxp flag)

(number-uid uname) - user name (login).

(number-uid gid) - the numerical identifier of group by default.

(number-uid home) - string, home directory.

(number-uid shell) - command interpreter by default.

(number-gid gname) - group name.

(number-gid gmem) - group members.

(nil getlogin) - the string, user name.

(nil getpid) - returns the process identifier.

(nil getppid) - returns the identifier of parental process.

(string-path chroot) - changes the root catalogue "/". Works only from the rights of the superuser.

(number nice) - change process priority. The new priority or nil comes back. The smaller priority gives more rights.

Index

&rest
&whole
#\enter
#\escape
#\space
#\tab
!
+ list
+ number
+ string
+ symbol
+ vector
+= cons
+= number
+= string
+= vector
- number
- symbol
- vector
-= number
-= vector
* number
* vector
*= number
*= vector
/
/=
= char
= cons
= false
= nil
= number
= string
= symbol
= true
= vector
<> char
<> cons
<> false
<> nil
<> number
<> string
<> symbol
<> true
<> vector
< char
< number
< string
< symbol
<= char
<= number
<= string
<= symbol
> char
> number
> string
> symbol
>= char
>= number
>= string
>= symbol
%
^
'
`
,
,@
abs
accessf
accessr
accesstime
accessw
accessx
acons
alphap
and
apply
arccos
arcosh
arcsin
arctan
arg
arg number
arsinh
artanh
assoc
atom
backquotep
bavail
bfree
bifp
blkp
blocks
blocksize
boundp
button-event
cbrt
ceil
cerr
changetime
char char
char number
charp
chdir
chroot
chrp
cin
clear
close dir
close stream
close window
code
combin
combina
cond
conj
cons nil
cons cons
consp
contain list
contain string
contain vector
controlp
copy char
copy cons
copy dir
copy number
copy object
copy string
copy time
copy vector
copy-list
copy-list-protected
copy-matrix
copy-tree
cos
cosh
count list
count string
count vector
count-if list
count-if string
count-if vector
cout
create
cot
coth
cycledp
day
daylightp
defclass
defmacro
defmethod
defvar
degrees
denom
device
digitp
dir
dirp
display-size
display-sizemm
do-while
draw-line
draw-pixel
draw-square
dstp
e
elt list
elt string
elt vector
empty
environment
environment-external
envp
eq
eval
evenp
exception
exception-history
exp
false
favail
ffree
fifop
files
find list
find string
find vector
find-if list
find-if string
find-if vector
finitep
first cons
first vector
floor
flush
for list
for number
for string
for vector
for* list
for* number
for* string
for* vector
fork
free
freeram
frsize
fsid
funcall
gcd
gensym
get
getclass
getcwd
getdebug
getegid
getenv
geteuid
getgid
getlogin
getmethod
getpid
getpixel
getppid
getstatic
getuid
gid number
gid string
gidp
gmem
gname
grpexecp
grpreadp
grpwritep
height
hide
history-show
home
hour
if
imag
infp
inode
insert
integerp
keyb-event
last cons
last vector
lcm
let
letset
lg
link
links
list nil
list string
list vector
list*
listen stream
listen window
listp
ln
lnkp
load
localtime
lockp
log
lower char
lower string
lowerp
ls
machine
map cons
map vector
mapc cons
mapc vector
mapwindow
max char
max number
max string
max symbol
merge
min char
min number
min string
min symbol
minutes
mkdir
modifytime
month
move window
multinomial
namemax
namespace
nanp
newobject char
newobject cons
newobject dir
newobject lock
newobject number
newobject signal
newobject string
newobject symbol
newobject time
newobject vector
nice
nil
nodename
nosuid
not
nprocs
num
number nil
number number
number time
numberp
objectp
oddp
open dir
open string
open window
openp dir
openp stream
openp window
or
othexecp
othreadp
othwritep
package
pairlist
parallel
part string
part vector
pi
pointer-coord
polar
pop
princ
print
printp
progn lock
progn nil
properties
push
put
quotep
radians
random
rassoc
rdevice
rdonly
read dir
read stream
read string
read-byte
read-char stream
read-char window
read-eval-print
read-keyb
read-line
readlink
real
regp
release
remove list
remove string
remove vector
remprop
rename string
rename window
replace list
replace string
replace vector
replace-if list
replace-if string
replace-if vector
resize string
resize vector
resize window
rest
reverse list
reverse vector
rewind
rmdir
round
save
second
seconds
seek
seekr
seekw
send
set lock
set symbol
setday
setdaylightp
setdebug
setegid
setelt list
setelt string
setelt vector
setenv
seteuid
setf char
setf cons
setf dir
setf number
setf string
setf time
setf vector
setfirst
setgid number
setgid string
setgidp
setgrpexecp
setgrpreadp
setgrpwritep
sethour
setlgid
setluid
setminutes
setmonth
setothexecp
setothreadp
setothwritep
setq
setrest
setseconds
setstatic
settime
settimezone
settzname
setuid number
setuid string
setuidp
setusrexecp
setusrreadp
setusrwritep
setvtxp
setyear
shell
signalp
sin
sinh
size cons
size string
size vector
sockp
sort
spacep
sqrt
streamp
string
string number
string string
string time
stringp
substitute
swap
symbol
symbolp
symlink
sysname
system
tan
tanh
tell
tellr
tellw
terpri
third
this
throw
time nil
time time
timep
timezone
totalram
totalsize
transpose
true
truncate
try lock
try nil
tzname
uid
uidp
uname
unlink
unquotep
unsetenv
upper char
upper string
upperp
uptime
usrexecp
usrreadp
usrwritep
vector cons
vector nil
vector string
vector vector
vectorp
version
vfsblocks
vfsblocksize
vtxp
wait
weekday
when
while
width
window nil
window window
windowp
write
write-byte
writeln
xk-…
xor
year
yearday