Usually you should not be trying to modify vectors themselves, only the elements stored in the vector, because vectors are designed for random access. They are fast. They are not designed to be searched or sorted. They are also immutable, so you cannot change them (only the elements). If you want change them (change their size), you must create a copy instead. Here is how to search a vector v for a value b using the loop macro. This may be more useful if you need to do things with the elements as you search. The distinction may also be important if you’re trying to avoid loading the CL package (it is always loaded in XEmacs): Functions require loading the CL package, macros only require loading the CL package at compile-time: DrewAdams has written library Lisp:ring+.el, which extends standard library ring.el to provides feature for using vectors as cyclic structures (“rings”). See RingPlus. This library includes function ‘ring-convert-sequence-to-ring’, which converts any sequence to a ring, which is a vector. A sequence is any of these: Don’t try to treat an obarray as a normal vector! The Elisp manual tells you this clearly, but I nevertheless tried to do this (programming idiom pointed out in the discussion of vectors in the same manual): Source.


Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified: April 18, 2016 @ 4:04 am