Vectors

  In data presentation it is often natural to make the ordered sets presented as a vector of objects of data. It is possible to refer to elements of a vector through their arrangement, nothing knowing about elements. On the other hand, the elements of data presented in the form of a vector it is possible to subject simply to uniform actions on the basis of their maintenance, for example such, as removal of the certain elements from set, ordering of set by any criterion and so on.
  Vectors like lists contain sequence of lisp objects, such as atoms, numbers, lists or other vectors. The external form of representation of vectors is

  #(x1 x2 … xn) ; n-element vector

  To elements of a vector it is possible to address effectively directly, to choose and appropriate it values, setting number of an element.

The basic actions with vectors

  The vector can be created by means of function

  ('vector newobject quantity [initial-element])

>('oh set ('vector newobject 4 'oh))
#(oh oh oh oh)

  Also it is possible to create a matrix, setting its dimension:

>('m set ('vector newobject '(3 4) 0))
#(#(0 0 0 0) #(0 0 0 0) #(0 0 0 0))

  It is possible to refer to a new element a call:

  (vector elt n)

>(oh elt 0) ; indexation begins with zero
oh

  The element of a matrix can be received so:

  (matrix elt x y)

>(m elt 1 2)
0

  To change an element, function of giving setelt is used:

>(oh setelt 0 'oy)
#(oy oh oh oh)
>(m setelt 1 2 7)
#(#(0 0 0 0) #(0 0 7 0) #(0 0 0 0))

  The part of a vector can be constructed a call:

  (vector part beginning [quantity])

>(oh part 0 2)
#(oy oh)

  Besides for vectors many functions mentioned in connection with work above lists, it - size, reverse and remove are generalized:

>(#(a b c) reverse)
#(c b a)
>(#(a b b a) remove 'a)
#(b b)