## 2 Sequences and Arrays and Hash Tables

Function: VECTOR (&rest objects)

  Package:LISP

  Constructs a Simple-Vector from the given objects.

Function: SUBSEQ (sequence start &optional (end (length sequence)))

  Package:LISP

  Returns a copy of a subsequence of SEQUENCE between START (inclusive) and END (exclusive).

Function: COPY-SEQ (sequence)

  Package:LISP

  Returns a copy of SEQUENCE.

Function: POSITION (item sequence &key (from-end nil) (test #'eql) test-not (start 0) (end (length sequence)) (key #'identity))

  Package:LISP

  Returns the index of the first element in SEQUENCE that satisfies TEST with ITEM; NIL if no such element exists.

Function: ARRAY-RANK (array)

  Package:LISP

  Returns the number of dimensions of ARRAY.

Function: SBIT (simple-bit-array &rest subscripts)

  Package:LISP

  Returns the bit from SIMPLE-BIT-ARRAY at SUBSCRIPTS.

Function: STRING-CAPITALIZE (string &key (start 0) (end (length string)))

  Package:LISP

  Returns a copy of STRING with the first character of each word converted to upper-case, and remaining characters in the word converted to lower case.

Function: NSUBSTITUTE-IF-NOT (new test sequence &key (from-end nil) (start 0) (end (length sequence)) (count most-positive-fixnum) (key #'identity))

  Package:LISP

  Returns a sequence of the same kind as SEQUENCE with the same elements

  except that all elements not satisfying TEST are replaced with NEWITEM. SEQUENCE may be destroyed.

Function: FIND-IF (test sequence &key (from-end nil) (start 0) (end (length sequence)) (key #'identity))

  Package:LISP

  Returns the index of the first element in SEQUENCE that satisfies TEST; NIL if no such element exists.

Function: BIT-EQV (bit-array1 bit-array2 &optional (result-bit-array nil))

  Package:LISP

  Performs a bit-wise logical EQV on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.

Function: STRING< (string1 string2 &key (start1 0) (end1 (length string1)) (start2 0) (end2 (length string2)))

  Package:LISP

  If STRING1 is lexicographically less than STRING2, then returns the longest common prefix of the strings. Otherwise, returns NIL.

Function: REVERSE (sequence)

  Package:LISP

  Returns a new sequence containing the same elements as SEQUENCE but in reverse order.

Function: NSTRING-UPCASE (string &key (start 0) (end (length string)))

  Package:LISP

  Returns STRING with all lower case characters converted to uppercase.

Function: STRING>= (string1 string2 &key (start1 0) (end1 (length string1)) (start2 0) (end2 (length string2)))

  Package:LISP

  If STRING1 is lexicographically greater than or equal to STRING2, then returns the longest common prefix of the strings. Otherwise, returns NIL.

Function: ARRAY-ROW-MAJOR-INDEX (array &rest subscripts)

  Package:LISP

  Returns the index into the data vector of ARRAY for the element of ARRAY specified by SUBSCRIPTS.

Function: ARRAY-DIMENSION (array axis-number)

  Package:LISP

  Returns the length of AXIS-NUMBER of ARRAY.

Function: FIND (item sequence &key (from-end nil) (test #'eql) test-not (start 0) (end (length sequence)) (key #'identity))

  Package:LISP

  Returns the first element in SEQUENCE satisfying TEST with ITEM; NIL if no such element exists.

Function: STRING-NOT-EQUAL (string1 string2 &key (start1 0) (end1 (length string1)) (start2 0) (end2 (length string2)))

  Package:LISP

  Similar to STRING=, but ignores cases.

Function: STRING-RIGHT-TRIM (char-bag string)

  Package:LISP

  Returns a copy of STRING with the characters in CHAR-BAG removed from the right end.

Function: DELETE-IF-NOT (test sequence &key (from-end nil) (start 0) (end (length sequence)) (count most-positive-fixnum) (key #'identity))

  Package:LISP

  Returns a sequence formed by destructively removing the elements not satisfying TEST from SEQUENCE.

Function: REMOVE-IF-NOT (test sequence &key (from-end nil) (start 0) (end (length sequence)) (count most-positive-fixnum) (key #'identity))

  Package:LISP

  Returns a copy of SEQUENCE with elements not satisfying TEST removed.

Function: STRING= (string1 string2 &key (start1 0) (end1 (length string1)) (start2 0) (end2 (length string2)))

  Package:LISP

  Returns T if the two strings are character-wise CHAR=; NIL otherwise.

Function: NSUBSTITUTE-IF (new test sequence &key (from-end nil) (start 0) (end (length sequence)) (count most-positive-fixnum) (key #'identity))

  Package:LISP

  Returns a sequence of the same kind as SEQUENCE with the same elements except that all elements satisfying TEST are replaced with NEWITEM. SEQUENCE may be destroyed.

Function: SOME (predicate sequence &rest more-sequences)

  Package:LISP

  Returns T if at least one of the elements in SEQUENCEs satisfies PREDICATE; NIL otherwise.

Function: MAKE-STRING (size &key (initial-element #\Space))

  Package:LISP

  Creates and returns a new string of SIZE length whose elements are all INITIAL-ELEMENT.

Function: NSUBSTITUTE (newitem olditem sequence &key (from-end nil) (test #'eql) test-not (start 0) (end (length sequence)) (count most-positive-fixnum) (key #'identity))

  Package:LISP

  Returns a sequence of the same kind as SEQUENCE with the same elements except that OLDITEMs are replaced with NEWITEM. SEQUENCE may be destroyed.

Function: STRING-EQUAL (string1 string2 &key (start1 0) (end1 (length string1)) (start2 0) (end2 (length string2)))

  Package:LISP

  Given two strings (string1 and string2), and optional integers start1, start2, end1 and end2, compares characters in string1 to characters in string2 (using char-equal).

Function: STRING-NOT-GREATERP (string1 string2 &key (start1 0) (end1 (length string1)) (start2 0) (end2 (length string2)))

  Package:LISP

  Similar to STRING<=, but ignores cases.

Function: STRING> (string1 string2 &key (start1 0) (end1 (length string1)) (start2 0) (end2 (length string2)))

  Package:LISP

  If STRING1 is lexicographically greater than STRING2, then returns the longest common prefix of the strings. Otherwise, returns NIL.

Function: STRINGP (x)

  Package:LISP

  Returns T if X is a string; NIL otherwise.

Function: DELETE-IF (test sequence &key (from-end nil) (start 0) (end (length sequence)) (count most-positive-fixnum) (key #'identity))

  Package:LISP

  Returns a sequence formed by removing the elements satisfying TEST destructively from SEQUENCE.

Function: SIMPLE-STRING-P (x)

  Package:LISP

  Returns T if X is a simple string; NIL otherwise.

Function: REMOVE-IF (test sequence &key (from-end nil) (start 0) (end (length sequence)) (count most-positive-fixnum) (key #'identity))

  Package:LISP

  Returns a copy of SEQUENCE with elements satisfying TEST removed.

Function: HASH-TABLE-COUNT (hash-table)

  Package:LISP

  Returns the number of entries in the given Hash-Table.

Function: ARRAY-DIMENSIONS (array)

  Package:LISP

  Returns a list whose elements are the dimensions of ARRAY

Function: SUBSTITUTE-IF-NOT (new test sequence &key (from-end nil) (start 0) (end (length sequence)) (count most-positive-fixnum) (key #'identity))

  Package:LISP

  Returns a sequence of the same kind as SEQUENCE with the same elements except that all elements not satisfying TEST are replaced with NEWITEM.

Function: ADJUSTABLE-ARRAY-P (array)

  Package:LISP

  Returns T if ARRAY is adjustable; NIL otherwise.

Function: SVREF (simple-vector index)

  Package:LISP

  Returns the INDEX-th element of SIMPLE-VECTOR.

Function: VECTOR-PUSH-EXTEND (new-element vector &optional (extension (length vector)))

  Package:LISP

  Similar to VECTOR-PUSH except that, if the fill pointer gets too large, extends VECTOR rather then simply returns NIL.

Function: DELETE (item sequence &key (from-end nil) (test #'eql) test-not (start 0) (end (length sequence)) (count most-positive-fixnum) (key #'identity))

  Package:LISP

  Returns a sequence formed by removing the specified ITEM destructively from SEQUENCE.

Function: REMOVE (item sequence &key (from-end nil) (test #'eql) test-not (start 0) (end (length sequence)) (count most-positive-fixnum) (key #'identity))

  Package:LISP

  Returns a copy of SEQUENCE with ITEM removed.

Function: STRING (x)

  Package:LISP

  Coerces X into a string. If X is a string, then returns X itself. If X is a symbol, then returns X’s print name. If X is a character, then returns a one element string containing that character. Signals an error if X cannot be coerced into a string.

Function: STRING-UPCASE (string &key (start 0) (end (length string)))

  Package:LISP

  Returns a copy of STRING with all lower case characters converted to uppercase.

Function: GETHASH (key hash-table &optional (default nil))

  Package:LISP

  Finds the entry in HASH-TABLE whose key is KEY and returns the associated value and T, as multiple values. Returns DEFAULT and NIL if there is no such entry.

Function: MAKE-HASH-TABLE (&key (test 'eql) (size 1024) (rehash-size 1.5) (rehash-threshold 0.7))

  Package:LISP

  Creates and returns a hash table.

Function: STRING/= (string1 string2 &key (start1 0) (end1 (length string1)) (start2 0) (end2 (length string2)))

  Package:LISP

  Returns NIL if STRING1 and STRING2 are character-wise CHAR=. Otherwise, returns the index to the longest common prefix of the strings.

Function: STRING-GREATERP (string1 string2 &key (start1 0) (end1 (length string1)) (start2 0) (end2 (length string2)))

  Package:LISP

  Similar to STRING>, but ignores cases.

Function: ELT (sequence index)

  Package:LISP

  Returns the INDEX-th element of SEQUENCE.

Function: MAKE-ARRAY (dimensions &key (element-type t) initial-element (initial-contents nil) (adjustable nil) (fill-pointer nil) (displaced-to nil) (displaced-index-offset 0) static)

  Package:LISP

  Creates an array of the specified DIMENSIONS. The default for INITIAL- ELEMENT depends on ELEMENT-TYPE. MAKE-ARRAY will always try to find the ‘best’ array to accommodate the element-type specified. For example on a SUN element-type (mod 1) –> bit (integer 0 10) –> unsigned-char (integer -3 10) –> signed-char si::best-array-element-type is the function doing this. It is also used by the compiler, for coercing array element types. If you are going to declare an array you should use the same element type as was used in making it. eg (setq my-array (make-array 4 :element-type ’(integer 0 10))) (the (array (integer 0 10)) my-array) When wanting to optimize references to an array you need to declare the array eg: (the (array (integer -3 10)) my-array) if ar were constructed using the (integer -3 10) element-type. You could of course have used signed-char, but since the ranges may be implementation dependent it is better to use -3 10 range. MAKE-ARRAY needs to do some calculation with the element-type if you don’t provide a primitive data-type. One way of doing this in a machine independent fashion:

  (defvar *my-elt-type* #. (array-element-type (make-array 1 :element-type ’(integer -3 10))))

  Then calls to (make-array n :element-type *my-elt-type*) will not have to go through a type inclusion computation. The keyword STATIC (GCL specific) if non nil, will cause the array body to be non relocatable.

Function: NSTRING-DOWNCASE (string &key (start 0) (end (length string)))

  Package:LISP Returns STRING with all upper case characters converted to lowercase.

Function: ARRAY-IN-BOUNDS-P (array &rest subscripts)

  Package:LISP Returns T if SUBSCRIPTS are valid subscripts for ARRAY; NIL otherwise.

Function: SORT (sequence predicate &key (key #'identity))

  Package:LISP Destructively sorts SEQUENCE. PREDICATE should return non-NIL if its first argument is to precede its second argument.

Function: HASH-TABLE-P (x)

  Package:LISP

  Returns T if X is a hash table object; NIL otherwise.

Function: COUNT-IF-NOT (test sequence &key (from-end nil) (start 0) (end (length sequence)) (key #'identity))

  Package:LISP

  Returns the number of elements in SEQUENCE not satisfying TEST.

Function: FILL-POINTER (vector)

  Package:LISP

  Returns the fill pointer of VECTOR.

Function: ARRAYP (x)

  Package:LISP

  Returns T if X is an array; NIL otherwise.

Function: REPLACE (sequence1 sequence2 &key (start1 0) (end1 (length sequence1)) (start2 0) (end2 (length sequence2)))

  Package:LISP

  Destructively modifies SEQUENCE1 by copying successive elements into it from SEQUENCE2.

Function: BIT-XOR (bit-array1 bit-array2 &optional (result-bit-array nil))

  Package:LISP

  Performs a bit-wise logical XOR on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.

Function: CLRHASH (hash-table)

  Package:LISP

  Removes all entries of HASH-TABLE and returns the hash table itself.

Function: SUBSTITUTE-IF (newitem test sequence &key (from-end nil) (start 0) (end (length sequence)) (count most-positive-fixnum) (key #'identity))

  Package:LISP

  Returns a sequence of the same kind as SEQUENCE with the same elements except that all elements satisfying TEST are replaced with NEWITEM.

Function: MISMATCH (sequence1 sequence2 &key (from-end nil) (test #'eql) test-not (start1 0) (start2 0) (end1 (length sequence1)) (end2 (length sequence2)) (key #'identity))

  Package:LISP

  The specified subsequences of SEQUENCE1 and SEQUENCE2 are compared element-wise. If they are of equal length and match in every element, the result is NIL. Otherwise, the result is a non-negative integer, the index within SEQUENCE1 of the leftmost position at which they fail to match; or, if one is shorter than and a matching prefix of the other, the index within SEQUENCE1 beyond the last position tested is returned.

Constant: ARRAY-TOTAL-SIZE-LIMIT

  Package:LISP The exclusive upper bound on the total number of elements of an array.

Function: VECTOR-POP (vector)

  Package:LISP

  Attempts to decrease the fill-pointer of VECTOR by 1 and returns the element pointed to by the new fill pointer. Signals an error if the old value of the fill pointer is 0.

Function: SUBSTITUTE (newitem olditem sequence &key (from-end nil) (test #'eql) test-not (start 0) (end (length sequence)) (count most-positive-fixnum) (key #'identity))

  Package:LISP

  Returns a sequence of the same kind as SEQUENCE with the same elements except that OLDITEMs are replaced with NEWITEM.

Function: ARRAY-HAS-FILL-POINTER-P (array)

  Package:LISP

  Returns T if ARRAY has a fill pointer; NIL otherwise.

Function: CONCATENATE (result-type &rest sequences)

  Package:LISP

  Returns a new sequence of the specified RESULT-TYPE, consisting of all elements in SEQUENCEs.

Function: VECTOR-PUSH (new-element vector)

  Package:LISP

  Attempts to set the element of ARRAY designated by its fill pointer to NEW-ELEMENT and increments the fill pointer by one. Returns NIL if the fill pointer is too large. Otherwise, returns the new fill pointer value.

Function: STRING-TRIM (char-bag string)

  Package:LISP

  Returns a copy of STRING with the characters in CHAR-BAG removed from both ends.

Function: ARRAY-ELEMENT-TYPE (array)

  Package:LISP

  Returns the type of the elements of ARRAY

Function: NOTANY (predicate sequence &rest more-sequences)

  Package:LISP

  Returns T if none of the elements in SEQUENCEs satisfies PREDICATE; NIL otherwise.

Function: BIT-NOT (bit-array &optional (result-bit-array nil))

  Package:LISP

  Performs a bit-wise logical NOT in the elements of BIT-ARRAY. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.

Function: BIT-ORC1 (bit-array1 bit-array2 &optional (result-bit-array nil))

  Package:LISP

  Performs a bit-wise logical ORC1 on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.

Function: COUNT-IF (test sequence &key (from-end nil) (start 0) (end (length sequence)) (key #'identity))

  Package:LISP

  Returns the number of elements in SEQUENCE satisfying TEST.

Function: MAP (result-type function sequence &rest more-sequences)

  Package:LISP

  FUNCTION must take as many arguments as there are sequences provided. The result is a sequence such that the i-th element is the result of applying FUNCTION to the i-th elements of the SEQUENCEs.

Constant: ARRAY-RANK-LIMIT

  Package:LISP The exclusive upper bound on the rank of an array.

Function: COUNT (item sequence &key (from-end nil) (test #'eql) test-not (start 0) (end (length sequence)) (key #'identity))

  Package:LISP

  Returns the number of elements in SEQUENCE satisfying TEST with ITEM.

Function: BIT-VECTOR-P (x)

  Package:LISP

  Returns T if X is a bit vector; NIL otherwise.

Function: NSTRING-CAPITALIZE (string &key (start 0) (end (length string)))

  Package:LISP

  Returns STRING with the first character of each word converted to upper-case, and remaining characters in the word converted to lower case.

Function: ADJUST-ARRAY (array dimensions &key (element-type (array-element-type array)) initial-element (initial-contents nil) (fill-pointer nil) (displaced-to nil) (displaced-index-offset 0))

  Package:LISP

  Adjusts the dimensions of ARRAY to the given DIMENSIONS. The default value of INITIAL-ELEMENT depends on ELEMENT-TYPE.

Function: SEARCH (sequence1 sequence2 &key (from-end nil) (test #'eql) test-not (start1 0) (start2 0) (end1 (length sequence1)) (end2 (length sequence2)) (key #'identity))

  Package:LISP

  A search is conducted for the first subsequence of SEQUENCE2 which element-wise matches SEQUENCE1. If there is such a subsequence in SEQUENCE2, the index of the its leftmost element is returned; otherwise, NIL is returned.

Function: SIMPLE-BIT-VECTOR-P (x)

  Package:LISP

  Returns T if X is a simple bit-vector; NIL otherwise.

Function: MAKE-SEQUENCE (type length &key initial-element)

  Package:LISP

  Returns a sequence of the given TYPE and LENGTH, with elements initialized to INITIAL-ELEMENT. The default value of INITIAL-ELEMENT depends on TYPE.

Function: BIT-ORC2 (bit-array1 bit-array2 &optional (result-bit-array nil))

  Package:LISP

  Performs a bit-wise logical ORC2 on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.

Function: NREVERSE (sequence)

  Package:LISP

  Returns a sequence of the same elements as SEQUENCE but in reverse order. SEQUENCE may be destroyed.

Constant: ARRAY-DIMENSION-LIMIT

  Package:LISP The exclusive upper bound of the array dimension.

Function: NOTEVERY (predicate sequence &rest more-sequences)

  Package:LISP

  Returns T if at least one of the elements in SEQUENCEs does not satisfy PREDICATE; NIL otherwise.

Function: POSITION-IF-NOT (test sequence &key (from-end nil) (start 0) (end (length sequence)) (key #'identity))

  Package:LISP

  Returns the index of the first element in SEQUENCE that does not satisfy TEST; NIL if no such element exists.

Function: STRING-DOWNCASE (string &key (start 0) (end (length string)))

  Package:LISP

  Returns a copy of STRING with all upper case characters converted to lowercase.

Function: BIT (bit-array &rest subscripts)

  Package:LISP

  Returns the bit from BIT-ARRAY at SUBSCRIPTS.

Function: STRING-NOT-LESSP (string1 string2 &key (start1 0) (end1 (length string1)) (start2 0) (end2 (length string2)))

  Package:LISP

  Similar to STRING>=, but ignores cases.

Function: CHAR (string index)

  Package:LISP

  Returns the INDEX-th character in STRING.

Function: AREF (array &rest subscripts)

  Package:LISP

  Returns the element of ARRAY specified by SUBSCRIPTS.

Function: FILL (sequence item &key (start 0) (end (length sequence)))

  Package:LISP

  Replaces the specified elements of SEQUENCE all with ITEM.

Function: STABLE-SORT (sequence predicate &key (key #'identity))

  Package:LISP

  Destructively sorts SEQUENCE. PREDICATE should return non-NIL if its first argument is to precede its second argument.

Function: BIT-IOR (bit-array1 bit-array2 &optional (result-bit-array nil))

  Package:LISP

  Performs a bit-wise logical IOR on the elements of BIT-ARRAY1 and BIT-ARRAY2. Puts the results into a new bit array if RESULT-BIT-ARRAY is NIL, into BIT-ARRAY1 if RESULT-BIT-ARRAY is T, or into RESULT-BIT-ARRAY otherwise.

Function: REMHASH (key hash-table)

  Package:LISP

  Removes any entry for KEY in HASH-TABLE. Returns T if such an entry existed; NIL otherwise.

Function: VECTORP (x)

  Package:LISP

  Returns T if X is a vector; NIL otherwise.

Function: STRING<= (string1 string2 &key (start1 0) (end1 (length string1)) (start2 0) (end2 (length string2)))

  Package:LISP

  If STRING1 is lexicographically less than or equal to STRING2, then returns the longest common prefix of the two strings. Otherwise, returns NIL.

Function: SIMPLE-VECTOR-P (x)

  Package:LISP

  Returns T if X is a simple vector; NIL otherwise.

Function: STRING-LEFT-TRIM (char-bag string)

  Package:LISP

  Returns a copy of STRING with the characters in CHAR-BAG removed from the left end.

Function: ARRAY-TOTAL-SIZE (array)

  Package:LISP

  Returns the total number of elements of ARRAY.

Function: FIND-IF-NOT (test sequence &key (from-end nil) (start 0) (end (length sequence)) (key #'identity))

  Package:LISP

  Returns the index of the first element in SEQUENCE that does not satisfy TEST; NIL if no such element exists.

Function: DELETE-DUPLICATES (sequence &key (from-end nil) (test #'eql) test-not (start 0) (end (length sequence)) (key #'identity))

  Package:LISP

  Returns a sequence formed by removing duplicated elements destructively from SEQUENCE.

Function: REMOVE-DUPLICATES (sequence &key (from-end nil) (test #'eql) test-not (start 0) (end (length sequence)) (key #'identity))

  Package:LISP

  The elements of SEQUENCE are examined, and if any two match, one is discarded. Returns the resulting sequence.

Function: POSITION-IF (test sequence &key (from-end nil) (start 0) (end (length sequence)) (key #'identity))

  Package:LISP

  Returns the index of the first element in SEQUENCE that satisfies TEST; NIL if no such element exists.

Function: MERGE (result-type sequence1 sequence2 predicate &key (key #'identity))

  Package:LISP

  SEQUENCE1 and SEQUENCE2 are destructively merged into a sequence of type RESULT-TYPE using PREDICATE to order the elements.

Function: EVERY (predicate sequence &rest more-sequences)

  Package:LISP

  Returns T if every elements of SEQUENCEs satisfy PREDICATE; NIL otherwise.

Function: REDUCE (function sequence &key (from-end nil) (start 0) (end (length sequence)) initial-value)

  Package:LISP

  Combines all the elements of SEQUENCE using a binary operation FUNCTION. If INITIAL-VALUE is supplied, it is logically placed before the SEQUENCE.

Function: STRING-LESSP (string1 string2 &key (start1 0) (end1 (length string1)) (start2 0) (end2 (length string2)))

  Package:LISP

  Similar to STRING<, but ignores cases.